Bugfix Held Weapon Actor Pending to be Destroyed
This commit is contained in:
parent
1873777770
commit
ec4b8c46b3
@ -534,12 +534,15 @@ 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
|
//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)
|
if (PrimaryWeaponClass != nullptr)
|
||||||
{
|
{
|
||||||
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Green, TEXT("non ifstatement code running"));
|
int PreviousAmmoCount = -1;
|
||||||
//PrimaryWeaponActor->AttachToComponent(FirstPersonArms, AttachmentRules, FName("GripPoint"));
|
|
||||||
HeldWeapon->SetChildActorClass(PrimaryWeaponClass);
|
|
||||||
if (PrimaryWeaponClass == PrimaryWeaponActor->GetClass())
|
if (PrimaryWeaponClass == PrimaryWeaponActor->GetClass())
|
||||||
{
|
{
|
||||||
Cast<ABaseWeaponClass>(HeldWeapon->GetChildActor())->currentAmmoCount = Cast<ABaseWeaponClass>(PrimaryWeaponActor)->currentAmmoCount;
|
PreviousAmmoCount = Cast<ABaseWeaponClass>(PrimaryWeaponActor)->currentAmmoCount;
|
||||||
|
}
|
||||||
|
HeldWeapon->SetChildActorClass(PrimaryWeaponClass);
|
||||||
|
if (PreviousAmmoCount >= 0)
|
||||||
|
{
|
||||||
|
Cast<ABaseWeaponClass>(HeldWeapon->GetChildActor())->currentAmmoCount = PreviousAmmoCount;
|
||||||
}
|
}
|
||||||
PrimaryWeaponActor = HeldWeapon->GetChildActor();
|
PrimaryWeaponActor = HeldWeapon->GetChildActor();
|
||||||
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
||||||
@ -609,10 +612,15 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
|||||||
}
|
}
|
||||||
if (SecondaryWeaponClass != nullptr)
|
if (SecondaryWeaponClass != nullptr)
|
||||||
{
|
{
|
||||||
HeldWeapon->SetChildActorClass(SecondaryWeaponClass);
|
int PreviousAmmoCount = -1;
|
||||||
if (SecondaryWeaponClass == SecondaryWeaponActor->GetClass())
|
if (SecondaryWeaponClass == SecondaryWeaponActor->GetClass())
|
||||||
{
|
{
|
||||||
Cast<ABaseWeaponClass>(HeldWeapon->GetChildActor())->currentAmmoCount = Cast<ABaseWeaponClass>(SecondaryWeaponActor)->currentAmmoCount;
|
PreviousAmmoCount = Cast<ABaseWeaponClass>(SecondaryWeaponActor)->currentAmmoCount;
|
||||||
|
}
|
||||||
|
HeldWeapon->SetChildActorClass(SecondaryWeaponClass);
|
||||||
|
if (PreviousAmmoCount >= 0)
|
||||||
|
{
|
||||||
|
Cast<ABaseWeaponClass>(HeldWeapon->GetChildActor())->currentAmmoCount = PreviousAmmoCount;
|
||||||
}
|
}
|
||||||
SecondaryWeaponActor = HeldWeapon->GetChildActor();
|
SecondaryWeaponActor = HeldWeapon->GetChildActor();
|
||||||
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
|
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
|
||||||
|
Loading…
Reference in New Issue
Block a user