Play Weapon Fire Sound in OnFire
This commit is contained in:
parent
a266215e98
commit
7c44598084
|
@ -384,7 +384,6 @@ void APlayerCharacter::RemoveWeaponFromInventory(int i)
|
|||
void APlayerCharacter::RemoveCurrentWeaponFromInventory()
|
||||
{
|
||||
// TODO: Add more checking here
|
||||
|
||||
}
|
||||
|
||||
void APlayerCharacter::OnFire()
|
||||
|
@ -406,7 +405,9 @@ void APlayerCharacter::OnFire()
|
|||
RemoveCurrentWeaponFromInventory();
|
||||
}
|
||||
|
||||
// TODO: Play sound effect
|
||||
CurrentWeapon->PlayFireSoundAtLocation(GetActorLocation());
|
||||
|
||||
// TODO: Play some animation here
|
||||
|
||||
CurrentWeapon->SetCurrentWeaponStatus(WeaponState::Cooldown);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
|
||||
#include "Weapon.h"
|
||||
#include <Kismet/GameplayStatics.h>
|
||||
|
||||
// Sets default values
|
||||
AWeapon::AWeapon()
|
||||
|
@ -68,6 +69,14 @@ void AWeapon::SetFireSound(USoundBase* USoundBase)
|
|||
FireSound = USoundBase;
|
||||
}
|
||||
|
||||
void AWeapon::PlayFireSoundAtLocation(FVector location)
|
||||
{
|
||||
if (!FireSound)
|
||||
{
|
||||
UGameplayStatics::PlaySoundAtLocation(this, FireSound, location);
|
||||
}
|
||||
}
|
||||
|
||||
int AWeapon::GetAmmoCount()
|
||||
{
|
||||
return AmmoCount;
|
||||
|
|
|
@ -104,6 +104,8 @@ public:
|
|||
|
||||
void SetFireSound(USoundBase* USoundBase);
|
||||
|
||||
void PlayFireSoundAtLocation(FVector location);
|
||||
|
||||
int GetAmmoCount();
|
||||
|
||||
void SetAmmoCount(int ammoCount);
|
||||
|
|
Loading…
Reference in New Issue