Add MVP wildlife audio hooks

This commit is contained in:
2026-05-19 12:33:01 -07:00
parent 6cad0682ff
commit f6e126aabb
5 changed files with 145 additions and 1 deletions
@@ -9,6 +9,8 @@
#include "AgrarianWildlifeBase.generated.h"
class AAgrarianGameCharacter;
class UAudioComponent;
class USoundBase;
class UStaticMeshComponent;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FAgrarianWildlifeStateChangedSignature, EAgrarianWildlifeState, NewState);
@@ -46,6 +48,9 @@ public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Wildlife|Visuals")
TObjectPtr<UStaticMeshComponent> WildlifeTailProxy;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Wildlife|Audio")
TObjectPtr<UAudioComponent> WildlifeAudioComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Wildlife")
FName WildlifeId = TEXT("wildlife");
@@ -109,6 +114,18 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Agrarian|Wildlife|Harvest")
bool bHarvested = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Wildlife|Audio")
TObjectPtr<USoundBase> IdleWildlifeSound;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Wildlife|Audio")
TObjectPtr<USoundBase> FleeWildlifeSound;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Wildlife|Audio")
TObjectPtr<USoundBase> DeathWildlifeSound;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Wildlife|Audio")
TObjectPtr<USoundBase> HarvestWildlifeSound;
UFUNCTION(BlueprintCallable, Category = "Agrarian|Wildlife")
bool IsAlive() const;
@@ -131,6 +148,12 @@ protected:
UFUNCTION()
void OnRep_WildlifeState();
UFUNCTION(NetMulticast, Unreliable)
void MulticastPlayWildlifeStateSound(EAgrarianWildlifeState NewState);
UFUNCTION(NetMulticast, Unreliable)
void MulticastPlayWildlifeHarvestSound();
bool ShouldRunServerThink(float DeltaSeconds);
void ServerThink(float DeltaSeconds);
void ChooseWanderTarget();
@@ -146,6 +169,7 @@ protected:
bool Harvest(AAgrarianGameCharacter* Interactor);
void BroadcastHealthChanged();
void BroadcastStateChanged();
USoundBase* GetSoundForWildlifeState(EAgrarianWildlifeState State) const;
UPROPERTY()
FVector SpawnLocation = FVector::ZeroVector;