Bugfix Primary Rifles Appear off screen

This commit is contained in:
Rafal Swierczek 2024-03-17 21:57:01 +00:00
parent 3633e1fe24
commit 530c9580ff
9 changed files with 24 additions and 12 deletions

View File

@ -397,6 +397,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
if (bIsReloading) return;
if (IsValid(PrimaryWeapon))
{
TempUnequippedPrimary();
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("IsPrimaryWeapon valid check running"));
PrimaryWeapon->DetachFromActor(DetatchRules);
PrimaryWeapon->AttachToComponent(FirstPersonArms, AttachmentRules, FName("UnEquipGunSocket"));
@ -439,7 +440,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
}
//For when you already have all your weapons and ur switching with 1 and 2 or when your picking up a weapon with a weapon in hand
if (PrimaryWeaponClass != nullptr)
{
{
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Green, TEXT("non ifstatement code running"));
PrimaryWeaponActor->AttachToComponent(FirstPersonArms, AttachmentRules, FName("GripPoint"));
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
@ -449,6 +450,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
bIsCurrentlyHoldingWeapon = true;
bHasRifle = true;
SetOverlayState(EOverlayState::AssaultRifle);
TempEquippedPrimary();
}
}

View File

@ -35,6 +35,11 @@ UCLASS(config=Game)
class AEndlessVendettaCharacter : public ACharacter
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintImplementableEvent)
void TempEquippedPrimary();
UFUNCTION(BlueprintImplementableEvent)
void TempUnequippedPrimary();
protected:
/** Pawn mesh: 1st person view (arms; seen only by self) */
@ -311,7 +316,9 @@ public:
void WeaponPickUpSystem();
UFUNCTION(BlueprintCallable)
void EquipPrimary();
UFUNCTION(BlueprintCallable)
void EquipSecondary();
void WeaponSwitcher(AActor* Outhit);

View File

@ -47,7 +47,7 @@ void ABaseWeaponClass::BeginPlay()
if (!IsValid(endlessVendettaChar)) return;
for (UActorComponent* actorComp : endlessVendettaChar->GetComponentsByTag(UArrowComponent::StaticClass(), FName("GunStart")))
for (UActorComponent* actorComp : playerInWorld->GetComponentsByTag(UArrowComponent::StaticClass(), FName("GunStart")))
{
GunStartArrow = Cast<UArrowComponent>(actorComp);
break;