Bugfix Ammo Get's Reset on Weapon Swap
This commit is contained in:
parent
454bb82a1b
commit
42f86bc2f2
@ -536,6 +536,10 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
||||
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Green, TEXT("non ifstatement code running"));
|
||||
//PrimaryWeaponActor->AttachToComponent(FirstPersonArms, AttachmentRules, FName("GripPoint"));
|
||||
HeldWeapon->SetChildActorClass(PrimaryWeaponClass);
|
||||
if (PrimaryWeaponClass == PrimaryWeaponActor->GetClass())
|
||||
{
|
||||
Cast<ABaseWeaponClass>(HeldWeapon->GetChildActor())->currentAmmoCount = Cast<ABaseWeaponClass>(PrimaryWeaponActor)->currentAmmoCount;
|
||||
}
|
||||
PrimaryWeaponActor = HeldWeapon->GetChildActor();
|
||||
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
||||
PrimaryWeapon->SetActorHiddenInGame(false);
|
||||
@ -600,6 +604,10 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
||||
if (SecondaryWeaponClass != nullptr)
|
||||
{
|
||||
HeldWeapon->SetChildActorClass(SecondaryWeaponClass);
|
||||
if (SecondaryWeaponClass == SecondaryWeaponActor->GetClass())
|
||||
{
|
||||
Cast<ABaseWeaponClass>(HeldWeapon->GetChildActor())->currentAmmoCount = Cast<ABaseWeaponClass>(SecondaryWeaponActor)->currentAmmoCount;
|
||||
}
|
||||
SecondaryWeaponActor = HeldWeapon->GetChildActor();
|
||||
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
|
||||
SecondaryWeapon->SetActorHiddenInGame(false);
|
||||
|
Loading…
Reference in New Issue
Block a user