Game.WeatherAudioData
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType (implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter)
Summary:
Represents configuration and references for weather-related audio used by the game's weather system (rain, water ambient sounds, lightning). Stored as a component data struct so it can be attached to entities and queried by ECS systems. Fields control thresholds, intensities, fade speeds, pitch ranges and references to audio prefab entities.
Fields
-
public float m_StartRaininess
Threshold raininess value at which rain audio should begin playing. Typical range 0.0–1.0 (normalized raininess). -
public float m_RainAudioIntensity
Global intensity multiplier for rain audio. Used to scale volume/behavior of rain sounds. -
public float m_RainFadeInSpeed
Speed at which rain audio fades in when raininess rises above m_StartRaininess. Higher values = faster fade-in. -
public float m_RainFadeOutSpeed
Speed at which rain audio fades out when raininess falls below thresholds. Higher values = faster fade-out. -
public float m_RainVolumeDeclineExponent
Exponent applied when calculating how rain volume decreases (e.g., to produce non-linear attenuation with zoom or distance). -
public float m_RainVolumeMaxZoomPercentage
Maximum fraction (0–1) of rain volume allowed when the camera is fully zoomed out. Controls how rain volume scales with camera zoom. -
public float m_LightningSoundSpeed
Speed factor or delay parameter relating to how lightning sounds are played/attenuated (units/context depend on audio system usage). -
public float2 m_MinMaxRaininessPitch
Min/max pitch multipliers for rain audio depending on raininess. Type is Unity.Mathematics.float2 where x = min pitch, y = max pitch. -
public Entity m_RainAudio
Entity reference to the rain audio prefab (Unity.Entities.Entity). Should point to an audio prefab/component used to play rain sounds. -
public float m_WaterAudioIntensity
Intensity multiplier for water-related ambient sounds (e.g., puddles, water flow). -
public float m_WaterFadeSpeed
Fade speed used for water ambient audio when enabling/disabling or adjusting intensity. -
public int m_WaterAudioEnabledZoom
Zoom level threshold (stored as int) that enables water ambient audio; below this zoom (or above, depending on convention) water audio may be suppressed. -
public int m_WaterAudioNearDistance
Distance (in world units) within which water ambient audio is considered "near" and may be played louder or with different attenuation. -
public Entity m_WaterAmbientAudio
Entity reference to the water ambient audio prefab (Unity.Entities.Entity). -
public Entity m_LightningAudio
Entity reference to the lightning audio prefab (Unity.Entities.Entity).
Properties
- This struct has no C# properties; it exposes public fields only.
Constructors
public WeatherAudioData()
The implicit default parameterless constructor provided for structs initializes all numeric fields to 0 (floats -> 0f, ints -> 0) and Entity fields to Entity.Null. Initialize fields explicitly when creating instances to avoid default-zero behavior where that is inappropriate.
Methods
- This type declares no methods. It is plain data for use with ECS systems and queries.
Usage Example
// Create and attach a WeatherAudioData component to an entity using EntityManager
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
// Create an entity with the WeatherAudioData component (and any required audio prefab entity references)
var entity = em.CreateEntity(typeof(Game.Prefabs.WeatherAudioData));
// Prepare a WeatherAudioData instance
var weatherAudio = new Game.Prefabs.WeatherAudioData
{
m_StartRaininess = 0.25f,
m_RainAudioIntensity = 1.0f,
m_RainFadeInSpeed = 0.8f,
m_RainFadeOutSpeed = 0.6f,
m_RainVolumeDeclineExponent = 1.2f,
m_RainVolumeMaxZoomPercentage = 0.5f,
m_LightningSoundSpeed = 1.0f,
m_MinMaxRaininessPitch = new Unity.Mathematics.float2(0.9f, 1.1f),
m_RainAudio = rainAudioPrefabEntity, // assign an Entity reference to the rain audio prefab
m_WaterAudioIntensity = 0.7f,
m_WaterFadeSpeed = 0.5f,
m_WaterAudioEnabledZoom = 2,
m_WaterAudioNearDistance = 50,
m_WaterAmbientAudio = waterAmbientPrefabEntity,
m_LightningAudio = lightningAudioPrefabEntity
};
// Set the component data on the entity
em.SetComponentData(entity, weatherAudio);
// Later, a system can read/update this component to drive audio playback based on current weather state.