Bugfix Gun Pending to be Destroyed
This commit is contained in:
parent
7fbd291029
commit
ce52c1bf6c
@ -493,6 +493,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
||||
PrimaryWeapon->HideNeedReloadUI();
|
||||
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
|
||||
UE_LOG(LogTemp, Warning, TEXT("Primary Weapon Is Hidden: %hhd"), PrimaryWeapon->IsHidden());
|
||||
PreviousPrimaryAmmoCount = PrimaryWeapon->currentAmmoCount;
|
||||
PrimaryWeapon = nullptr;
|
||||
bHasRifle = false;
|
||||
GLog->Log("Primary Weapon Put Away");
|
||||
@ -535,9 +536,9 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
||||
if (PrimaryWeaponClass != nullptr)
|
||||
{
|
||||
int PreviousAmmoCount = -1;
|
||||
if (PrimaryWeaponClass == PrimaryWeaponActor->GetClass())
|
||||
if (PrimaryWeaponClass == PreviousPrimaryWeaponClass)
|
||||
{
|
||||
PreviousAmmoCount = Cast<ABaseWeaponClass>(PrimaryWeaponActor)->currentAmmoCount;
|
||||
PreviousAmmoCount = PreviousPrimaryAmmoCount;
|
||||
}
|
||||
HeldWeapon->SetChildActorClass(PrimaryWeaponClass);
|
||||
if (PreviousAmmoCount >= 0)
|
||||
@ -545,6 +546,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
||||
Cast<ABaseWeaponClass>(HeldWeapon->GetChildActor())->currentAmmoCount = PreviousAmmoCount;
|
||||
}
|
||||
PrimaryWeaponActor = HeldWeapon->GetChildActor();
|
||||
PreviousPrimaryWeaponClass = PrimaryWeaponClass;
|
||||
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
||||
PrimaryWeapon->SetActorHiddenInGame(false);
|
||||
PrimaryWeapon->SetActorEnableCollision(false);
|
||||
@ -579,6 +581,7 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
||||
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
|
||||
PreviousSecondaryAmmoCount = SecondaryWeapon->currentAmmoCount;
|
||||
SecondaryWeapon = nullptr;
|
||||
bIsCurrentlyHoldingWeapon = false;
|
||||
bHasRifle = false;
|
||||
@ -613,9 +616,9 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
||||
if (SecondaryWeaponClass != nullptr)
|
||||
{
|
||||
int PreviousAmmoCount = -1;
|
||||
if (SecondaryWeaponClass == SecondaryWeaponActor->GetClass())
|
||||
if (SecondaryWeaponClass == PreviousSecondaryWeaponClass)
|
||||
{
|
||||
PreviousAmmoCount = Cast<ABaseWeaponClass>(SecondaryWeaponActor)->currentAmmoCount;
|
||||
PreviousAmmoCount = PreviousSecondaryAmmoCount;
|
||||
}
|
||||
HeldWeapon->SetChildActorClass(SecondaryWeaponClass);
|
||||
if (PreviousAmmoCount >= 0)
|
||||
@ -623,6 +626,7 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
||||
Cast<ABaseWeaponClass>(HeldWeapon->GetChildActor())->currentAmmoCount = PreviousAmmoCount;
|
||||
}
|
||||
SecondaryWeaponActor = HeldWeapon->GetChildActor();
|
||||
PreviousSecondaryWeaponClass = SecondaryWeaponClass;
|
||||
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
|
||||
SecondaryWeapon->SetActorHiddenInGame(false);
|
||||
if (SecondaryWeapon->currentAmmoCount <= 0)
|
||||
|
@ -235,6 +235,16 @@ protected:
|
||||
FTimerHandle NotInCombatTimerHandle;
|
||||
void NotInCombat();
|
||||
|
||||
UPROPERTY()
|
||||
int PreviousPrimaryAmmoCount = 0;
|
||||
UPROPERTY()
|
||||
int PreviousSecondaryAmmoCount = 0;
|
||||
UPROPERTY()
|
||||
TSubclassOf<ABaseWeaponClass> PreviousPrimaryWeaponClass;
|
||||
UPROPERTY()
|
||||
TSubclassOf<ABaseWeaponClass> PreviousSecondaryWeaponClass;
|
||||
|
||||
|
||||
public:
|
||||
AGadgetManager* GadgetManager;
|
||||
bool bIsReloading = false;
|
||||
|
Loading…
Reference in New Issue
Block a user