Game.Prefabs.WastewaterTreatmentPlantData
Assembly: Assembly-CSharp (game/mod assembly)
Namespace: Game.Prefabs
Type: struct (value type)
Base: System.ValueType
Summary:
Represents the runtime data for a wastewater treatment plant prefab in the ECS world. This struct is an IComponentData so it can be attached to entities, implements IQueryTypeParameter for use in queries, ICombineData
Fields
-
public int m_Capacity
Holds the plant's capacity as an integer in the game's internal units. Used to represent how much wastewater the plant can handle. When combining multiple components, capacities are summed. -
public int m_WaterStorage
Holds the current stored water/wastewater amount in the plant in the game's internal units. When combining multiple components, stored water values are summed.
Properties
- This type defines no properties. It exposes plain public fields only.
Constructors
public WastewaterTreatmentPlantData()
(implicit default)
As a struct, it has the default parameterless constructor provided by C#. Both m_Capacity and m_WaterStorage default to 0 unless set explicitly.
Methods
-
public void Combine(WastewaterTreatmentPlantData otherData)
Combines another instance into this one by adding its m_Capacity and m_WaterStorage to this instance. Useful when aggregating multiple sources (for example, when constructing totals for a group of entities). -
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes the component data in a deterministic order to the provided writer. Implementation writes m_Capacity, then m_WaterStorage. The generic writer allows this to work with different serialization backends used by the game/mod framework. -
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads the component data from the provided reader into the fields. Implementation reads m_Capacity, then m_WaterStorage, restoring the same order used in Serialize.
Usage Example
// Creating and combining two data instances
var dataA = new WastewaterTreatmentPlantData { m_Capacity = 1000, m_WaterStorage = 250 };
var dataB = new WastewaterTreatmentPlantData { m_Capacity = 500, m_WaterStorage = 100 };
// Aggregate totals
dataA.Combine(dataB);
// dataA now has m_Capacity = 1500, m_WaterStorage = 350
// Example serialization (pseudo-code, depends on game's writer implementation)
SomeWriter writer = GetWriter();
dataA.Serialize(writer);
// Example deserialization
SomeReader reader = GetReader();
var loaded = new WastewaterTreatmentPlantData();
loaded.Deserialize(reader);
Notes: - The exact units used for capacity and water storage depend on the game's conventions (e.g., liters, cubic meters, or abstract units). Treat these as game-internal integer units. - Because this is an ECS component (IComponentData), use it with Unity.Entities systems and queries rather than as a standalone MonoBehaviour.