Skip to content

Game.Prefabs.WaterPipeConnectionData

Assembly: Assembly-CSharp (game assembly)
Namespace: Game.Prefabs

Type: public struct

Base: System.ValueType
Implements: IComponentData, IQueryTypeParameter, ISerializable

Summary:
Represents capacity values for a water pipe connection in the ECS world. Holds integer capacities for fresh water, sewage, and stormwater. The struct is an ECS component (IComponentData) and supports custom binary serialization (ISerializable) using generic IWriter/IReader interfaces. The serialized order is: m_FreshCapacity, m_SewageCapacity, m_StormCapacity.


Fields

  • public int m_FreshCapacity
    Capacity (integer) reserved for fresh water flow through this connection. Used to track or limit fresh water throughput.

  • public int m_SewageCapacity
    Capacity (integer) reserved for sewage flow through this connection. Used to track or limit sewage throughput.

  • public int m_StormCapacity
    Capacity (integer) reserved for stormwater flow through this connection. Used to track or limit stormwater throughput.

Properties

  • (none)
    This struct exposes no C# properties; data is stored in public fields.

Constructors

  • public WaterPipeConnectionData()
    Default parameterless constructor (implicit for C# structs). All fields initialize to 0. No custom constructors are defined in the source.

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the three capacity fields to the provided writer in the following order: m_FreshCapacity, m_SewageCapacity, m_StormCapacity. Consumers of this serialized data must read in the same order and type (int).

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads three integers from the provided reader into the fields, in the same order used during serialization: m_FreshCapacity, m_SewageCapacity, m_StormCapacity. Uses ref locals to assign directly to fields.

Notes: - The serialization format is compact and does not include field identifiers; order and types must be preserved for compatibility. - Intended for use with the game's custom Colossal.Serialization entities framework (IWriter / IReader).

Usage Example

// Create and populate component (typically when creating a prefab or entity)
var pipeConnection = new WaterPipeConnectionData
{
    m_FreshCapacity = 1200,
    m_SewageCapacity = 800,
    m_StormCapacity = 500
};

// Example: serializing with a writer (pseudo-code)
// var writer = new SomeWriter(...);
// pipeConnection.Serialize(writer);

// Example: deserializing (pseudo-code)
// var reader = new SomeReader(...);
// var readConnection = default(WaterPipeConnectionData);
// readConnection.Deserialize(reader);