Add MVP ambient biome audio hook

This commit is contained in:
2026-05-19 12:01:24 -07:00
parent c37d8d930c
commit fb658baff0
5 changed files with 89 additions and 12 deletions
@@ -83,7 +83,9 @@ void AAgrarianWeatherAudioController::RefreshWeatherAudio(float DeltaSeconds)
break;
}
const float TargetAmbientVolume = GameState->IsNight() ? AmbientNightVolume : AmbientDayVolume;
const float DayAmbient = FMath::Max(AmbientDayVolume, BiomeAmbientDayVolume);
const float NightAmbient = FMath::Max(AmbientNightVolume, BiomeAmbientNightVolume);
const float TargetAmbientVolume = GameState->IsNight() ? NightAmbient : DayAmbient;
const float InterpSpeed = FMath::Max(0.1f, VolumeInterpSpeed);
CurrentAmbientVolume = FMath::FInterpTo(CurrentAmbientVolume, TargetAmbientVolume, DeltaSeconds, InterpSpeed);
CurrentRainVolume = FMath::FInterpTo(CurrentRainVolume, TargetRainVolume, DeltaSeconds, InterpSpeed);
@@ -106,7 +108,11 @@ void AAgrarianWeatherAudioController::RefreshWeatherAudio(float DeltaSeconds)
void AAgrarianWeatherAudioController::AssignConfiguredSounds()
{
if (AmbientAudio && ClearAmbientSound)
if (AmbientAudio && BiomeAmbientLoopSound)
{
AmbientAudio->SetSound(BiomeAmbientLoopSound);
}
else if (AmbientAudio && ClearAmbientSound)
{
AmbientAudio->SetSound(ClearAmbientSound);
}
@@ -40,6 +40,9 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio")
TObjectPtr<USoundBase> ClearAmbientSound;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio|Biome")
TObjectPtr<USoundBase> BiomeAmbientLoopSound;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio")
TObjectPtr<USoundBase> RainLoopSound;
@@ -58,6 +61,12 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio", meta = (ClampMin = "0.0", ClampMax = "1.0"))
float AmbientNightVolume = 0.22f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio|Biome", meta = (ClampMin = "0.0", ClampMax = "1.0"))
float BiomeAmbientDayVolume = 0.35f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio|Biome", meta = (ClampMin = "0.0", ClampMax = "1.0"))
float BiomeAmbientNightVolume = 0.22f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio", meta = (ClampMin = "0.0", ClampMax = "1.0"))
float MaxRainVolume = 0.8f;