Game.Prefabs.WaterSourceData
Assembly: Assembly-CSharp (typical Unity/game assembly; adjust to the actual mod/game assembly if different)
Namespace: Game.Prefabs
Type: public struct WaterSourceData
Base: System.ValueType (struct); implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
A small ECS data component representing a water source prefab's parameters. Contains the source radius, available amount, and initial pollution level. Designed to be attached to entities (prefabs or spawned entities) so water-related systems can read source properties and simulate water supply/pollution. As a struct implementing IComponentData it is plain data (no behavior) and serializes as part of the entity's component data.
Fields
-
public System.Single m_Radius
Represents the effective radius of the water source (area of influence). Units depend on the game's world scale (typically meters). Systems use this to determine which tiles/entities are affected by the source. Typical values: tens to hundreds depending on map scale. -
public System.Single m_Amount
The quantity of water available from the source. This may represent total capacity or a flow rate depending on how the consuming systems interpret it. Check the consuming systems to know whether this is consumed over time or used as a constant supply. -
public System.Single m_InitialPolluted
Initial pollution level of the water source. Usually a normalized value (e.g., 0 = clean, 1 = fully polluted); confirm expected range with consuming systems. Used to seed pollution propagation from the source.
Properties
- None (this struct exposes public fields rather than property accessors)
Constructors
- Implicit default constructor (public WaterSourceData())
As a struct, it has a default parameterless constructor that initializes all floats to 0. If you need non-zero defaults, initialize explicitly when creating the component.
Methods
- None (no methods defined on the struct)
Usage Example
// Create and assign the component on an entity (EntityManager example)
var waterSource = new Game.Prefabs.WaterSourceData
{
m_Radius = 50f,
m_Amount = 10000f,
m_InitialPolluted = 0.05f
};
entityManager.AddComponentData(entity, waterSource);
// Or when creating from a prefab, ensure the prefab entity has this component set accordingly.
{{ Additional notes: - This component is pure data for use with Unity.Entities (DOTS). Systems should read/write it via EntityManager or ISystem/ComponentSystem APIs. - Verify expected semantics (amount as capacity vs. rate, pollution range, radius units) by checking the water simulation systems in the project or game. - If you want per-instance initialization on prefab conversion, set these values during conversion (IConvertGameObjectToEntity) or when spawning entities. }}