Add logic to throw weapon once weapon ammo is depleted
This commit is contained in:
parent
7f4de48fb0
commit
12db67439f
|
@ -219,6 +219,12 @@ void APlayerCharacter::BeginFireCallback(const FInputActionInstance& Instance)
|
|||
return;
|
||||
}
|
||||
|
||||
if (CurrentWeapon->GetAmmoCount() == 0)
|
||||
{
|
||||
ThrowWeaponCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
IsFiring = true;
|
||||
|
||||
OnFire();
|
||||
|
@ -478,7 +484,7 @@ void APlayerCharacter::EndAimDownSightsCallback(const FInputActionInstance& Inst
|
|||
|
||||
void APlayerCharacter::OnFire()
|
||||
{
|
||||
if (!IsFiring)
|
||||
if (!IsFiring || CurrentWeapon->GetAmmoCount() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -497,11 +503,6 @@ void APlayerCharacter::OnFire()
|
|||
|
||||
CurrentWeapon->SetCurrentWeaponStatus(Cooldown);
|
||||
|
||||
if (CurrentWeapon->GetAmmoCount() == 0)
|
||||
{
|
||||
RemoveCurrentWeaponFromInventory();
|
||||
}
|
||||
|
||||
Super::OnFire();
|
||||
}
|
||||
|
||||
|
@ -592,6 +593,8 @@ void APlayerCharacter::ThrowWeaponCallback()
|
|||
|
||||
Throwable->SetWeaponSkeletalMesh(GetCurrentWeapon()->GetSkeletalMesh());
|
||||
}
|
||||
|
||||
RemoveCurrentWeaponFromInventory();
|
||||
}
|
||||
|
||||
void APlayerCharacter::ThrowExplosiveCallback()
|
||||
|
|
Loading…
Reference in New Issue