Game.Simulation.TransportVehicleRequest
Assembly: Assembly-CSharp (game logic)
Namespace: Game.Simulation
Type: struct (value type)
Base: System.ValueType
Implements: IComponentData, IQueryTypeParameter, ISerializable
Summary:
Represents an ECS component used to request a transport vehicle for a specific route. Carries the target route as an Entity and a floating-point priority value used by systems that schedule or satisfy vehicle requests (higher values typically indicate higher priority). The struct provides custom serialization/deserialization to persist or transfer the request data across save/load or networking subsystems.
Fields
-
public Entity m_Route
Holds the Entity that identifies the transport route (for example, a line/route entity). This is the route for which a vehicle is being requested. -
public float m_Priority
A numeric priority assigned to this request. Systems consuming this component can use this value to decide ordering or importance when allocating vehicles.
Properties
- This type does not declare C# properties. It exposes its data via public fields and implements ISerializable for explicit read/write behavior.
Constructors
public TransportVehicleRequest(Entity route, float priority)
Initializes a new TransportVehicleRequest with the given route entity and priority value.
Methods
-
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes the component data (m_Route and m_Priority) to the provided writer. The implementation first writes the route Entity followed by the priority float. -
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads component data from the provided reader into the fields m_Route and m_Priority. Uses out/read semantics to populate the struct's fields.
Usage Example
// Create a request for a route entity with a given priority
Entity someRoute = /* obtain route entity */;
var request = new TransportVehicleRequest(someRoute, 1.5f);
// Example: serialize the request (pseudo-code, depends on writer implementation)
using (var writer = GetWriter())
{
request.Serialize(writer);
}
// Example: deserialize back
TransportVehicleRequest loadedRequest = default;
using (var reader = GetReader())
{
loadedRequest.Deserialize(reader);
}