Game.Routes.DispatchedRequest
Assembly: Assembly-CSharp (game assembly)
Namespace: Game.Routes
Type: struct
Base: IBufferElementData, ISerializable
Summary:
Represents a buffer element used by the game's ECS routing/dispatch system to record a vehicle request that has been dispatched. The struct holds a single Entity reference (the requested vehicle entity) and implements Colossal.Serialization's ISerializable so instances can be written/read by the game's serializer. The buffer is annotated with [InternalBufferCapacity(0)], indicating no inline capacity and that storage is external.
Fields
public Unity.Entities.Entity m_VehicleRequest
Holds the Entity reference for the dispatched vehicle request. This value is serialized/deserialized via the ISerializable implementation. When default-initialized on a struct it will be Entity.Null.
Properties
- None.
Constructors
public DispatchedRequest()
Default (parameterless) struct constructor. Initializes the struct with default values (m_VehicleRequest == Entity.Null).
Methods
-
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes the m_VehicleRequest entity to the provided writer. Used by the game's serialization pipeline (Colossal.Serialization.Entities). -
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads an Entity value from the provided reader into m_VehicleRequest. Restores the dispatched request reference during deserialization.
Usage Example
// Add a dispatched request to an entity's dynamic buffer
public void AddDispatchedRequest(EntityManager em, Entity ownerEntity, Entity vehicleEntity)
{
var buffer = em.GetBuffer<DispatchedRequest>(ownerEntity);
buffer.Add(new DispatchedRequest { m_VehicleRequest = vehicleEntity });
}
// During serialization the Serialize<TWriter> method is invoked by the engine's serializer.
// During load the Deserialize<TReader> method restores m_VehicleRequest.