Skip to content

Game.Tools.WaterSourceDefinition

Assembly: Assembly-CSharp (inferred)
Namespace: Game.Tools

Type: struct

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

Summary:
Represents a water source definition used by the game's ECS water simulation. This struct is a plain data (blittable) component that describes a localized water source: its world position, effective radius, amount/strength, optional constant depth flag/value, a multiplier for scaling effect, and pollution level. It is intended to be attached to entities and read by systems/jobs that perform water simulation or rendering.


Fields

  • public float3 m_Position
    World-space position of the water source (Unity.Mathematics.float3). Use world coordinates consistent with the game's terrain/world space.

  • public int m_ConstantDepth
    Integer value that indicates constant-depth behavior. The meaning is implementation-dependent (commonly used as a boolean flag: 0 = dynamic depth, 1 = constant depth, or it may encode a depth value). Check the consuming systems to determine exact semantics in the game.

  • public float m_Amount
    The base amount/strength of the water source (how much water it contributes). Units and scaling depend on the simulation; m_Multiplier further scales this value.

  • public float m_Radius
    Effective radius/area of influence for the water source (likely in world units such as meters). Systems will typically consider this when applying the source to the water grid.

  • public float m_Multiplier
    Multiplier applied to m_Amount to scale the water source strength at runtime without changing m_Amount directly.

  • public float m_Polluted
    Pollution level of the water emitted by this source. Typically a normalized value (e.g., 0 = clean, 1 = fully polluted), but verify with consuming code.

Properties

  • None. This struct exposes only fields and implements ECS marker interfaces.

Constructors

  • public WaterSourceDefinition()
    Default value-type constructor exists implicitly. It is recommended to initialize fields explicitly when creating a component instance to avoid default-zero values that may be invalid for your use case.

Methods

  • None declared. This is a pure data component. Implemented interfaces (IComponentData, IQueryTypeParameter) are marker/infrastructure interfaces used by Unity's ECS and query system.

Usage Example

using Unity.Entities;
using Unity.Mathematics;
using Game.Tools;

// Create and attach a water source component to an entity
var waterSource = new WaterSourceDefinition
{
    m_Position = new float3(100f, 0f, 200f),
    m_ConstantDepth = 1, // treat as constant depth (check consuming system)
    m_Amount = 500f,
    m_Radius = 25f,
    m_Multiplier = 1.0f,
    m_Polluted = 0.0f
};

EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = entityManager.CreateEntity();
entityManager.AddComponentData(entity, waterSource);

Notes and tips: - Because this is a blittable struct used by jobs/systems, keep the data layout simple and avoid managed references. - Confirm the exact semantics (units, ranges, meaning of m_ConstantDepth) by inspecting the systems that read this component in the game's codebase when creating or modifying water sources.