Game.Simulation.WaterPipeNode
Assembly:
Game (assembly not explicitly specified in source; part of the game's Simulation code)
Namespace:
Game.Simulation
Type:
struct (value type)
Base:
Implements IComponentData, IQueryTypeParameter, ISerializable
Summary:
A lightweight ECS component representing a node in the game's water pipe system. It stores an index identifying the node and a float representing the "fresh pollution" value. The component implements Colossal's ISerializable to persist the fresh pollution value; the index is not serialized by the provided implementation. It is intended to be used with Unity's DOTS/ECS (IComponentData) and as a query parameter helper (IQueryTypeParameter).
Fields
-
public int m_Index
Index of this water pipe node within the pipe-network data structure. This field is used at runtime to identify the node but is not written by the custom Serialize method, so it is not preserved by the provided serialization logic. -
public float m_FreshPollution
Current fresh-water pollution value for this node. This field is serialized and deserialized through the ISerializable implementation.
Properties
- This type does not define any C# properties.
Constructors
public WaterPipeNode()
Default parameterless struct constructor (implicitly provided). When created with the default constructor, m_Index will be 0 and m_FreshPollution will be 0.0f unless explicitly initialized.
Methods
-
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes this instance's persistent data to the provided writer. The implementation writes only m_FreshPollution: writer.Write(m_FreshPollution). m_Index is intentionally not written. -
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads persisted data from the provided reader into this instance. The implementation reads a single float and stores it into m_FreshPollution: reader.Read(out m_FreshPollution). The reader does not populate m_Index.
Usage Example
// Creating and using the component
var node = new WaterPipeNode
{
m_Index = 42,
m_FreshPollution = 0.0f
};
// Example: serializing the component (pseudo-code; depends on game's writer implementation)
writer.Write(node.m_FreshPollution);
// Example: deserializing the component (pseudo-code)
reader.Read(out node.m_FreshPollution);
// Adding to an entity in Unity ECS (conceptual)
entityManager.AddComponentData(entity, node);