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