Implemented weapon switch feedback

This commit is contained in:
TjgL 2025-01-23 23:46:59 +01:00
parent d12dbb7c82
commit 954ae7c36d
6 changed files with 22 additions and 5 deletions

Binary file not shown.

Binary file not shown.

BIN
Content/Legumix/Weapon/WeaponSwitchPlaceholder.uasset (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -40,6 +40,11 @@ void ALMWeaponBase::Setup(USkeletalMeshComponent* Mesh, AActor* CharOwner)
Player = Cast<ALMPlayer>(CharOwner); Player = Cast<ALMPlayer>(CharOwner);
} }
void ALMWeaponBase::OnEquip_Implementation()
{
PlaySound(EquipSound);
}
bool ALMWeaponBase::Reload() bool ALMWeaponBase::Reload()
{ {
return DefaultReload(); return DefaultReload();

View File

@ -161,5 +161,7 @@ void ULMWeaponManager::SetWeapon(const int Index)
GetCurrentWeapon()->SetActorHiddenInGame(true); GetCurrentWeapon()->SetActorHiddenInGame(true);
CurrentWeaponIndex = Index; CurrentWeaponIndex = Index;
GetCurrentWeapon()->SetActorHiddenInGame(false); GetCurrentWeapon()->SetActorHiddenInGame(false);
GetCurrentWeapon()->OnEquip();
} }

View File

@ -22,6 +22,10 @@ public:
void Setup(USkeletalMeshComponent* Mesh, AActor* CharOwner); void Setup(USkeletalMeshComponent* Mesh, AActor* CharOwner);
public: public:
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category=Legumix)
void OnEquip();
virtual void OnEquip_Implementation();
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
virtual bool Reload(); virtual bool Reload();
@ -67,6 +71,9 @@ protected: /* Weapon Data */
UPROPERTY(EditAnywhere, BlueprintReadWrite,Category="Legumix|Sounds") UPROPERTY(EditAnywhere, BlueprintReadWrite,Category="Legumix|Sounds")
TObjectPtr<USoundWave> DryFireSound; TObjectPtr<USoundWave> DryFireSound;
UPROPERTY(EditAnywhere, BlueprintReadWrite,Category="Legumix|Sounds")
TObjectPtr<USoundWave> EquipSound;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Animations", meta=(AllowPrivateAccess=true)) UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Animations", meta=(AllowPrivateAccess=true))
TObjectPtr<UAnimMontage> PrimaryFireAnimation; TObjectPtr<UAnimMontage> PrimaryFireAnimation;