Bugfix Need Reload UI Persisting on Overlay State Change

This commit is contained in:
Philip W 2024-05-12 17:29:45 +01:00
parent 42f86bc2f2
commit c042d6f3af

View File

@ -490,6 +490,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
//PrimaryWeapon->AttachToComponent(FirstPersonArms, AttachmentRules, FName("UnEquipGunSocket"));
PrimaryWeapon->SetActorHiddenInGame(true);
PrimaryWeapon->SetActorEnableCollision(false);
PrimaryWeapon->HideNeedReloadUI();
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
UE_LOG(LogTemp, Warning, TEXT("Primary Weapon Is Hidden: %hhd"), PrimaryWeapon->IsHidden());
PrimaryWeapon = nullptr;
@ -544,6 +545,10 @@ void AEndlessVendettaCharacter::EquipPrimary()
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
PrimaryWeapon->SetActorHiddenInGame(false);
PrimaryWeapon->SetActorEnableCollision(false);
if (PrimaryWeapon->currentAmmoCount <= 0)
{
PrimaryWeapon->ShowNeedReloadUI();
}
//GetWorldTimerManager().ClearTimer(PrimaryWeapon->reloadTimerHandle);
bIsCurrentlyHoldingWeapon = true;
bHasRifle = true;
@ -568,6 +573,7 @@ void AEndlessVendettaCharacter::EquipSecondary()
SecondaryWeapon->SetActorHiddenInGame(true);
SecondaryWeapon->SetActorEnableCollision(false);
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
SecondaryWeapon->HideNeedReloadUI();
UE_LOG(LogTemp, Warning, TEXT("Secondary Weapon Is Hidden: %hhd"), SecondaryWeapon->IsHidden());
//the nullptr makes it so we can unequip and requip the same weapon
SecondaryWeapon = nullptr;
@ -611,6 +617,10 @@ void AEndlessVendettaCharacter::EquipSecondary()
SecondaryWeaponActor = HeldWeapon->GetChildActor();
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
SecondaryWeapon->SetActorHiddenInGame(false);
if (SecondaryWeapon->currentAmmoCount <= 0)
{
SecondaryWeapon->ShowNeedReloadUI();
}
bIsCurrentlyHoldingWeapon = true;
SetOverlayState(EOverlayState::Pistol);
GetWorldTimerManager().ClearTimer(SecondaryWeapon->reloadTimerHandle);