Tested FMOD integration by replacing some SoundAssets by FMODEvent:
Firing and reloading have been replaced. Signed-off-by: TjgL <lithmoneo@gmail.com>
This commit is contained in:
parent
0108c69639
commit
0dbef497a7
BIN
Content/Legumix/Weapon/Revolver/BP_Revolver.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Weapon/Revolver/BP_Revolver.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Weapon/Shotgun/BP_Shotgun.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Weapon/Shotgun/BP_Shotgun.uasset
(Stored with Git LFS)
Binary file not shown.
@ -31,7 +31,7 @@ void ALMRevolver::PrimaryFire()
|
||||
}
|
||||
|
||||
|
||||
PlaySound(FireSound, true);
|
||||
PlayEvent(FireEvent);
|
||||
PlayAnimation(PrimaryFireAnimation);
|
||||
|
||||
const FVector Origin = Player->GetWeaponFiringOrigin();
|
||||
|
@ -30,7 +30,7 @@ void ALMShotgun::PrimaryFire()
|
||||
return;
|
||||
}
|
||||
|
||||
PlaySound(FireSound, true);
|
||||
PlayEvent(FireEvent);
|
||||
PlayAnimation(PrimaryFireAnimation);
|
||||
|
||||
const FVector Origin = Player->GetWeaponFiringOrigin();
|
||||
|
@ -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;
|
||||
|
@ -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<USoundWave> FireSound;
|
||||
TObjectPtr<UFMODEvent> FireEvent;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite,Category="Legumix|Sounds")
|
||||
TObjectPtr<USoundWave> ReloadSound;
|
||||
TObjectPtr<UFMODEvent> ReloadSound;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite,Category="Legumix|Sounds")
|
||||
TObjectPtr<USoundWave> DryFireSound;
|
||||
|
Reference in New Issue
Block a user