Skip to content

Game.EndFrameBarrier

Assembly:
Assembly-CSharp.dll

Namespace: Game.Net

Type: struct

Base: IComponentData, IQueryTypeParameter, ISerializable

Summary: Represents a garage lane component used by the game's ECS. Stores basic per-lane data: parking fee, comfort factor, current number of vehicles and capacity. Implements Colossal's ISerializable to support custom binary read/write for save/load and network operations, and implements IComponentData so it can be attached to entities and used in ECS queries.


Fields

  • public ushort m_ParkingFee Holds the parking fee for this garage lane as an unsigned 16-bit integer. Stored and serialized as a ushort.

  • public ushort m_ComfortFactor A ushort representing the comfort factor for vehicles using this lane. Range 0–65535.

  • public ushort m_VehicleCount Current number of vehicles present in this lane. Stored as a ushort.

  • public ushort m_VehicleCapacity Maximum vehicle capacity for this lane. Stored as a ushort.

Properties

  • None This struct exposes no C# properties. All data members are public fields intended for direct access by systems and serializers.

Constructors

  • public GarageLane() (implicit) As a value type (struct) it has the default parameterless constructor which zero-initializes all ushort fields. No explicit constructors are defined in the source.

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter Writes the four ushort fields to the provided writer in the following order: m_ParkingFee, m_ComfortFactor, m_VehicleCount, m_VehicleCapacity. The order is significant and must match Deserialize.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader Reads the four ushort fields from the provided reader into the struct's fields using the same order as Serialize: parking fee, comfort factor, vehicle count, vehicle capacity. Uses reader.Read(out refField) to populate each field.

Notes: - The Serialize/Deserialize methods are generic over writer/reader types from Colossal.Serialization.Entities and rely on the writer/reader supporting Write(ushort) / Read(out ushort). - Because this is an ECS component (IComponentData) and a simple blittable struct of primitive types, it is suitable for native jobs and entity storage. - Maintain serialization order and type sizes to ensure save-game and network compatibility across versions.

Usage Example

// Create and initialize a GarageLane component, then serialize it using a writer.
GarageLane lane = new GarageLane
{
    m_ParkingFee = 250,       // example fee
    m_ComfortFactor = 1200,   // example comfort value
    m_VehicleCount = 5,
    m_VehicleCapacity = 20
};

// Example writer usage (writer implementation depends on Colossal.Serialization.Entities)
void SaveLane<TWriter>(ref GarageLane lane, TWriter writer) where TWriter : IWriter
{
    lane.Serialize(writer);
}

// Example deserialization
void LoadLane<TReader>(out GarageLane lane, TReader reader) where TReader : IReader
{
    lane = default;
    lane.Deserialize(reader);
}