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);
}
void ALMWeaponBase::OnEquip_Implementation()
{
PlaySound(EquipSound);
}
bool ALMWeaponBase::Reload()
{
return DefaultReload();

View File

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

View File

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