Skip to content

Game.Prefabs.TransportStopInfomodePrefab

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: class

Base: ColorInfomodeBasePrefab

Summary:
Prefab class used by the infomode system to represent transport stops. Adds the InfoviewTransportStopData component to the prefab and initializes that component on the created Entity with the configured transport type (m_Type). The class is exposed to the Unity editor via the ComponentMenu attribute for "Tools/Infomode/".


Fields

  • public TransportType m_Type
    The transport stop type configured on this prefab (e.g., Bus, Train, Tram). This value is copied into the InfoviewTransportStopData component during Initialize so the infomode system knows which transport type this stop represents.

  • (Implicit) The prefab also results in the addition of the component type InfoviewTransportStopData to the entity via GetPrefabComponents. This is not a field on the class but is important prefab data that will exist on created entities.

Properties

  • This class does not declare any properties.

Constructors

  • public TransportStopInfomodePrefab()
    Default parameterless constructor (implicit). Instances are typically constructed/instantiated by the game's prefab/system; no custom construction logic is defined.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Adds component types that should be present on entities created from this prefab. This override calls the base implementation and then adds ComponentType.ReadWrite<InfoviewTransportStopData>(), ensuring the InfoviewTransportStopData component will exist and be writable on spawned entities.

  • public override void Initialize(EntityManager entityManager, Entity entity)
    Called when an entity is created from this prefab. Calls the base Initialize, then sets the InfoviewTransportStopData component on the provided entity using the prefab's m_Type: entityManager.SetComponentData(entity, new InfoviewTransportStopData { m_Type = m_Type });

Usage Example

// Example: when the game/spawn system instantiates the prefab, Initialize will be called.
// The prefab stores which TransportType it represents in m_Type and writes it to the entity's component.

TransportStopInfomodePrefab prefab = new TransportStopInfomodePrefab();
prefab.m_Type = TransportType.Bus; // configured in editor or by code

// Pseudo-flow executed by the prefab system:
Entity entity = /* created entity for prefab */;
prefab.Initialize(entityManager, entity);

// After Initialize, the entity has an InfoviewTransportStopData component with m_Type == TransportType.Bus