Game.WeatherPhenomenonData
Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
Represents configuration data for a weather phenomenon (storm, tornado, lightning event, etc.) used by the game's ECS-based weather system. This component stores probabilities, bounds for sizes/durations/intervals, severity/danger metrics and flags that control when and how a phenomenon can occur and how severe its effects are. It is a plain, blittable data container intended to be attached to entities/prefabs.
Fields
-
public float m_OccurenceProbability
Probability that this phenomenon will occur during an evaluation period. Typical range 0..1 where 1 means it will always occur when other conditions are met. -
public float m_HotspotInstability
A factor controlling how likely hotspots (localized stronger effects) are to form or change. Higher values increase randomness/instability of hotspots. -
public float m_DamageSeverity
A scalar describing how damaging the phenomenon is to game objects (infrastructure, buildings, vehicles). Used by damage systems to scale effects. -
public float m_DangerLevel
An aggregated danger rating used by AI/other systems to determine risk level and potentially trigger warnings/behaviors. -
public Bounds1 m_PhenomenonRadius
Range (min/max) describing the overall radius/area of effect for the phenomenon. -
public Bounds1 m_HotspotRadius
Range for the radius of more intense hotspot areas inside the phenomenon. -
public Bounds1 m_LightningInterval
Range for the interval between lightning strikes (if applicable). Usually expressed in seconds. -
public Bounds1 m_Duration
Range for how long the phenomenon lasts (seconds). -
public Bounds1 m_OccurenceTemperature
Temperature bounds within which this phenomenon can occur (e.g., low temps for snow/ice, high for heat phenomena). -
public Bounds1 m_OccurenceRain
Rainfall bounds (intensity or amount) that constrain when the phenomenon can occur. -
public DangerFlags m_DangerFlags
Bitmask flags (defined in Game.Events) indicating specific danger categories or behaviors (for example: fire, flood, lightning, infrastructure impact). Used by systems reacting to or filtering phenomena by type.
Properties
- This struct defines no C# properties. It is a pure data container using public fields for direct ECS access.
Constructors
public WeatherPhenomenonData()
Structs have an implicit parameterless constructor. Initialize fields explicitly when creating instances. No custom constructors are defined in-source.
Methods
- None. This type is a data-only component (IComponentData) and contains no behavior.
Usage Example
using Unity.Entities;
using Colossal.Mathematics;
using Game.Prefabs;
using Game.Events;
// Create and add to an entity (e.g., a prefab entity for a storm)
var phenomenon = new WeatherPhenomenonData
{
m_OccurenceProbability = 0.25f,
m_HotspotInstability = 0.5f,
m_DamageSeverity = 1.2f,
m_DangerLevel = 3.0f,
m_PhenomenonRadius = new Bounds1(200f, 600f),
m_HotspotRadius = new Bounds1(50f, 150f),
m_LightningInterval = new Bounds1(2f, 8f),
m_Duration = new Bounds1(60f, 300f),
m_OccurenceTemperature = new Bounds1(-10f, 35f),
m_OccurenceRain = new Bounds1(0f, 100f),
m_DangerFlags = DangerFlags.Lightning | DangerFlags.InfraDamage
};
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity stormEntity = entityManager.CreateEntity();
entityManager.AddComponentData(stormEntity, phenomenon);
Notes: - Bounds1 is a simple min/max range type (Colossal.Mathematics) used throughout the game for randomized ranges. - DangerFlags is a bitmask enum located in Game.Events—use it to combine multiple danger categories. - Because this is an ECS IComponentData struct, modify instances by creating a new struct and calling SetComponentData / AddComponentData rather than mutating shared/static state.