Skip to content

Game.Routes.TrainStop

Assembly: Assembly-CSharp.dll
Namespace: Game.Routes

Type: struct

Base: IComponentData, IQueryTypeParameter, IEmptySerializable

Summary:
TrainStop is a marker (empty/tag) ECS component used to identify entities that represent train stops in the game's routing/transport systems. It carries no data; the presence of the component on an entity is used by systems and queries to select or operate on train-stop entities. The StructLayout(Size = 1) attribute ensures the struct is non-zero sized (important for certain serialization or interop scenarios), and implementing IEmptySerializable and IQueryTypeParameter allows it to participate in the game's custom serialization and query mechanisms.


Fields

  • This struct contains no instance fields. It is intentionally empty and acts solely as a tag to identify train stop entities.
    {{ The component is a pure marker: use presence/absence to represent state rather than storing data in this component. }}

Properties

  • This component exposes no properties.
    {{ Use other components to store related data (e.g., position, platform info, route references). }}

Constructors

  • public TrainStop() (implicit)
    {{ As an empty value type, it uses the implicit parameterless constructor. The StructLayout(Size = 1) attribute guarantees a non-zero managed size for serialization/interoperability reasons. }}

Methods

  • This type declares no methods.
    {{ Behavior related to train stops is implemented in systems that query for the presence of this component. }}

Usage Example

// Add the tag to an existing entity:
entityManager.AddComponentData(entity, new TrainStop());

// Or add the component type to an entity (no data needed):
entityManager.AddComponent<TrainStop>(entity);

// Query for all train stop entities in a SystemBase:
EntityQuery trainStopQuery = GetEntityQuery(ComponentType.ReadOnly<TrainStop>());

Entities
    .WithAll<TrainStop>()
    .ForEach((Entity e, in Translation pos) =>
    {
        // operate on train stop entities
    })
    .ScheduleParallel();

{{ Notes: - Use this component when you only need to mark an entity as a train stop; attach additional components for position, routing, or state. - IEmptySerializable ties into the game's/custom serialization path so the empty component can be serialized/deserialized correctly. - IQueryTypeParameter allows it to be used in query/type-parameter contexts for performance-friendly queries. }}