Skip to content

Game.Prefabs.WaterLevelChangeData

Assembly:
Assembly-CSharp (game code / modding assembly)

Namespace:
Game.Prefabs

Type:
struct

Base:
System.ValueType, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
Represents a component that describes a planned or ongoing change to the water level (e.g., flooding or receding) and associated danger information. This data container is intended to be attached to entities in the ECS world to indicate how water level behavior should be handled for that entity or region. It is a simple, blittable value type suitable for use in Jobs and ECS queries.


Fields

  • public WaterLevelTargetType m_TargetType
    Defines the target scope or target of the water level change. This is an enum (WaterLevelTargetType) used to specify what the change applies to (for example: a specific tile/region, global water system, or other target as defined by the game's enums).

  • public WaterLevelChangeType m_ChangeType
    Specifies how the water level should change. This enum (WaterLevelChangeType) typically encodes the nature of the change (e.g., increase, decrease, stop, ramp up, sudden spike). Consult the enum definition for exact values and semantics.

  • public float m_EscalationDelay
    A delay (in seconds) before escalation or before the change is applied or intensified. Use this to schedule gradual changes or provide a buffer time before an effect takes place.

  • public DangerFlags m_DangerFlags
    A bitmask/enum describing which danger types are relevant to this water level change (for example flooding, contamination, structural risk, etc.). These flags allow systems to quickly filter and react only to relevant danger categories.

  • public float m_DangerLevel
    A numeric severity or intensity value associated with the danger caused by the water level change. Higher values typically indicate more severe danger; the exact interpretation is determined by the systems that consume this component.

Properties

  • This struct defines no properties. It is a plain data component with public fields for direct access.

Constructors

  • public WaterLevelChangeData()
    The compiler-provided default constructor initializes fields to their default values (enum fields to their 0 value, floats to 0.0f). Create instances with object initializer syntax to set meaningful values before attaching to an entity.

Methods

  • This component type declares no methods. It is a pure data container intended for ECS storage and queries.

Usage Example

// Add using directives:
// using Unity.Entities;
// using Game.Prefabs; // for WaterLevelChangeData
// using Game.Events; // for WaterLevelTargetType, WaterLevelChangeType, DangerFlags

// Example: create an entity and add the component with initial values
EntityManager em = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity e = em.CreateEntity();

// initialize a water level change that will escalate after 10 seconds,
// marks the change as an increase and sets a danger level
em.AddComponentData(e, new WaterLevelChangeData {
    m_TargetType = WaterLevelTargetType.Region,   // example enum value
    m_ChangeType = WaterLevelChangeType.Increase, // example enum value
    m_EscalationDelay = 10f,
    m_DangerFlags = DangerFlags.Flooding,         // example flag
    m_DangerLevel = 0.75f
});

Notes and tips: - Because this type implements IComponentData and only contains blittable fields (enums and floats), it is safe and efficient to use in Jobs and burst-compiled systems. - The IQueryTypeParameter implementation indicates this type can be used as part of query parameterization in the ECS query APIs; check the project's ECS utilities and systems for patterns that use IQueryTypeParameter. - To understand valid enum values and flag meanings, inspect the definitions of WaterLevelTargetType, WaterLevelChangeType, and DangerFlags in the game's codebase. Use those enums to ensure consistent behavior across systems that react to water-level events.