// Copyright Pacificao. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "GameFramework/Actor.h" #include "AgrarianTypes.h" #include "AgrarianWeatherAudioController.generated.h" class UAudioComponent; class USceneComponent; class USoundBase; UCLASS(Blueprintable) class AAgrarianWeatherAudioController : public AActor { GENERATED_BODY() public: AAgrarianWeatherAudioController(); virtual void BeginPlay() override; virtual void Tick(float DeltaSeconds) override; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Weather Audio") TObjectPtr SceneRoot; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Weather Audio") TObjectPtr AmbientAudio; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Weather Audio") TObjectPtr RainAudio; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Weather Audio") TObjectPtr WindAudio; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Weather Audio") TObjectPtr StormAudio; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio") TObjectPtr ClearAmbientSound; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio") TObjectPtr RainLoopSound; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio") TObjectPtr WindLoopSound; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio") TObjectPtr StormLoopSound; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio", meta = (ClampMin = "0.1")) float VolumeInterpSpeed = 1.5f; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio", meta = (ClampMin = "0.0", ClampMax = "1.0")) float AmbientDayVolume = 0.35f; 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", meta = (ClampMin = "0.0", ClampMax = "1.0")) float MaxRainVolume = 0.8f; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio", meta = (ClampMin = "0.0", ClampMax = "1.0")) float MaxWindVolume = 0.7f; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Weather Audio", meta = (ClampMin = "0.0", ClampMax = "1.0")) float MaxStormVolume = 0.9f; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Weather Audio") EAgrarianWeatherType CurrentWeather = EAgrarianWeatherType::Clear; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Weather Audio") float CurrentAmbientVolume = 0.0f; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Weather Audio") float CurrentRainVolume = 0.0f; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Weather Audio") float CurrentWindVolume = 0.0f; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Weather Audio") float CurrentStormVolume = 0.0f; UFUNCTION(BlueprintCallable, Category = "Agrarian|Weather Audio") void RefreshWeatherAudio(float DeltaSeconds); protected: void AssignConfiguredSounds(); void ApplyComponentVolume(UAudioComponent* AudioComponent, float Volume) const; float GetProviderWindAlpha(float WindSpeedKmh, bool bHasProviderData) const; };