diff --git a/Content/Legumix/Weapon/Revolver/BP_Revolver.uasset b/Content/Legumix/Weapon/Revolver/BP_Revolver.uasset index f523f63..ddeacaf 100644 --- a/Content/Legumix/Weapon/Revolver/BP_Revolver.uasset +++ b/Content/Legumix/Weapon/Revolver/BP_Revolver.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d24798de748b9e2c9dbcea3e3573668ca10e352c7098efa22e391c6b99bbf7c4 -size 41706 +oid sha256:c98f77d416772eb10fed3580bef23694f4c8a924cecdd8c5700ddd4a8ea36bf8 +size 41693 diff --git a/Content/Legumix/Weapon/Shotgun/BP_Shotgun.uasset b/Content/Legumix/Weapon/Shotgun/BP_Shotgun.uasset index 456d6e1..5e844cd 100644 --- a/Content/Legumix/Weapon/Shotgun/BP_Shotgun.uasset +++ b/Content/Legumix/Weapon/Shotgun/BP_Shotgun.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7a58b5c7dab95516d2666029887e1563c3234442e2d2f4b71ccd2e9bb870788 -size 29766 +oid sha256:cd4804bd01f8a952299e99e597ba98f6439738fa9745dec6d0214616e7f21827 +size 29749 diff --git a/Source/LegumeMix/Private/Weapon/LMRevolver.cpp b/Source/LegumeMix/Private/Weapon/LMRevolver.cpp index 1bfc3f2..c965fa8 100644 --- a/Source/LegumeMix/Private/Weapon/LMRevolver.cpp +++ b/Source/LegumeMix/Private/Weapon/LMRevolver.cpp @@ -31,7 +31,7 @@ void ALMRevolver::PrimaryFire() } - PlaySound(FireSound, true); + PlayEvent(FireEvent); PlayAnimation(PrimaryFireAnimation); const FVector Origin = Player->GetWeaponFiringOrigin(); diff --git a/Source/LegumeMix/Private/Weapon/LMShotgun.cpp b/Source/LegumeMix/Private/Weapon/LMShotgun.cpp index 7d2ecee..fe64093 100644 --- a/Source/LegumeMix/Private/Weapon/LMShotgun.cpp +++ b/Source/LegumeMix/Private/Weapon/LMShotgun.cpp @@ -30,7 +30,7 @@ void ALMShotgun::PrimaryFire() return; } - PlaySound(FireSound, true); + PlayEvent(FireEvent); PlayAnimation(PrimaryFireAnimation); const FVector Origin = Player->GetWeaponFiringOrigin(); diff --git a/Source/LegumeMix/Private/Weapon/LMWeaponBase.cpp b/Source/LegumeMix/Private/Weapon/LMWeaponBase.cpp index 73b0ed1..8c676af 100644 --- a/Source/LegumeMix/Private/Weapon/LMWeaponBase.cpp +++ b/Source/LegumeMix/Private/Weapon/LMWeaponBase.cpp @@ -3,6 +3,7 @@ #include "Weapon/LMWeaponBase.h" +#include "FMODBlueprintStatics.h" #include "LMUtils.h" #include "Components/AudioComponent.h" #include "Player/LMPlayer.h" @@ -68,6 +69,11 @@ void ALMWeaponBase::PlaySound(USoundWave* Sound, const bool Replacing) AudioComponent->Play(); } +void ALMWeaponBase::PlayEvent(UFMODEvent* Event) const +{ + UFMODBlueprintStatics::PlayEventAttached(Event, RootComponent, TEXT(""), FVector::Zero(), EAttachLocation::Type::SnapToTarget, true, true, true); +} + void ALMWeaponBase::PlayAnimation(UAnimMontage* Animation) { UAnimInstance* AnimInstance = WeaponMesh->GetAnimInstance(); @@ -94,7 +100,7 @@ bool ALMWeaponBase::DefaultReload() if (ClipAmmo >= MaxClip) return false; - PlaySound(ReloadSound, true); + PlayEvent(ReloadSound); PlayAnimation(ReloadAnimation); State = EWeaponState::EWS_Reloading; diff --git a/Source/LegumeMix/Public/Weapon/LMWeaponBase.h b/Source/LegumeMix/Public/Weapon/LMWeaponBase.h index d59e45d..5ac21c3 100644 --- a/Source/LegumeMix/Public/Weapon/LMWeaponBase.h +++ b/Source/LegumeMix/Public/Weapon/LMWeaponBase.h @@ -9,6 +9,7 @@ #include "LMWeaponBase.generated.h" +class UFMODEvent; class ALMPlayer; UCLASS() @@ -34,6 +35,8 @@ public: UFUNCTION(BlueprintCallable) void PlaySound(USoundWave* Sound, bool Replacing = false); + UFUNCTION(BlueprintCallable) + void PlayEvent(UFMODEvent* Event) const; UFUNCTION(BlueprintCallable) void PlayAnimation(UAnimMontage* Animation); @@ -71,10 +74,10 @@ protected: /* Weapon Data */ /** The sound to play when firing. */ UPROPERTY(EditAnywhere, BlueprintReadWrite,Category="Legumix|Sounds") - TObjectPtr FireSound; + TObjectPtr FireEvent; UPROPERTY(EditAnywhere, BlueprintReadWrite,Category="Legumix|Sounds") - TObjectPtr ReloadSound; + TObjectPtr ReloadSound; UPROPERTY(EditAnywhere, BlueprintReadWrite,Category="Legumix|Sounds") TObjectPtr DryFireSound;