Game.Routes.TaxiStand
Assembly:
Game (Assembly-CSharp)
Namespace: Game.Routes
Type:
struct
Base:
IComponentData, IQueryTypeParameter, ISerializable
Summary:
Represents a taxi stand component used by the routing/transport system. Stores an Entity reference to an outstanding taxi request, a set of flags describing the stand state, and the starting fee for a taxi. Implements ISerializable to persist/restore state with version-aware reading/writing to maintain compatibility across save versions.
Fields
-
public Entity m_TaxiRequest
Holds an Entity reference representing the current taxi request associated with this stand (or Entity.Null if none). Serialized via writer.Write(Entity). -
public TaxiStandFlags m_Flags
Bitmask flags describing the taxi stand's state. Serialized as a uint. When deserializing, this value is read only if reader.context.version >= Version.taxiStandFlags. -
public ushort m_StartingFee
Starting fee (in game currency units) charged for a taxi from this stand. Read from serialized data only if reader.context.version >= Version.taxiFee.
Properties
- (none)
This struct exposes only public fields; there are no properties defined.
Constructors
public TaxiStand()
Default value-type constructor provided by C#. No custom constructor is defined in source; initialize fields explicitly when creating instances.
Methods
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes the component state to the provided writer in the following order:- m_TaxiRequest (Entity)
- m_Flags (written as uint)
-
m_StartingFee (ushort) This method is used by the saving system to persist the TaxiStand.
-
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads component state from the provided reader. Behavior: - Always reads m_TaxiRequest.
- If reader.context.version >= Version.taxiStandFlags, reads a uint and assigns it to m_Flags.
- If reader.context.version >= Version.taxiFee, reads a ushort into m_StartingFee. This method is version-aware to preserve compatibility with older saves that may lack newer fields.
Usage Example
// Create and add a TaxiStand component to an entity (EntityManager API shown for Unity.Entities)
var taxiStand = new TaxiStand
{
m_TaxiRequest = Entity.Null,
m_Flags = TaxiStandFlags.None,
m_StartingFee = 150
};
entityManager.AddComponentData(someEntity, taxiStand);
// Example pseudocode for handling deserialization (within the game's serialization system)
public void ReadTaxiStand<TReader>(ref TaxiStand stand, TReader reader) where TReader : IReader
{
reader.Read(out stand.m_TaxiRequest);
if (reader.context.version >= Version.taxiStandFlags)
{
reader.Read(out uint flagsValue);
stand.m_Flags = (TaxiStandFlags)flagsValue;
}
if (reader.context.version >= Version.taxiFee)
{
reader.Read(out stand.m_StartingFee);
}
}
Notes: - The Version.taxiStandFlags and Version.taxiFee tokens are defined elsewhere in the game's versioning enum/struct; they gate reading of fields added in later versions. - Because this is a struct implementing IComponentData, use the ECS EntityManager / System API to add, read, or update instances on entities.