Skip to content

Game.Creatures.RideNeeder

Assembly: Assembly-CSharp
Namespace: Game.Creatures

Type: struct

Base: IComponentData, IQueryTypeParameter, ISerializable

Summary:
RideNeeder is a small ECS component that stores an Entity reference to a requested ride (for example, a vehicle or transportation service entity). It is intended for use with Unity.Entities-based gameplay systems and implements Colossal.Serialization.Entities.ISerializable so the contained Entity reference can be written/read by the game's serialization system. Use Entity.Null to indicate "no request".


Fields

  • public Unity.Entities.Entity m_RideRequest
    Holds the Entity reference for the requested ride. This is a plain Unity.Entities.Entity value (not a UnityEngine.Object). When there is no active request this should typically be Entity.Null. This field is what gets serialized/deserialized by the implemented ISerializable methods.

Properties

  • None
    This struct exposes no properties; the field m_RideRequest is public and used directly.

Constructors

  • public RideNeeder()
    Default (parameterless) struct constructor — value-initializes m_RideRequest to Entity.Null unless explicitly assigned. In C# structs the implicit parameterless constructor sets the field to its default.

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the m_RideRequest Entity to the provided writer. Used by the Colossal serialization pipeline to persist or replicate the ride request reference.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads an Entity value from the provided reader into m_RideRequest. Used by the serialization pipeline to restore the component state.

Usage Example

// Add a RideNeeder component to an entity and set the requested ride:
var rideRequestEntity = /* some vehicle/service entity */;
var rideNeeder = new RideNeeder { m_RideRequest = rideRequestEntity };
entityManager.AddComponentData(personEntity, rideNeeder);

// Read the component:
if (entityManager.HasComponent<RideNeeder>(personEntity))
{
    var rn = entityManager.GetComponentData<RideNeeder>(personEntity);
    var requested = rn.m_RideRequest;
    // handle requested ride...
}

// Clear the request when a ride is assigned or cancelled:
var updated = new RideNeeder { m_RideRequest = Unity.Entities.Entity.Null };
entityManager.SetComponentData(personEntity, updated);

// Notes:
// - Serialization methods (Serialize/Deserialize) are called by the game's serializer; you normally don't call them directly.
// - Use Entity.Null to represent "no ride requested".