Game.Prefabs.VehicleLaunch
Assembly: Assembly-CSharp (inferred)
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
VehicleLaunch is a prefab component used to configure a vehicle-launch event prefab for the game's ECS. It exposes a TransportType to choose which transport category the event will use, registers the runtime components required by the prefab/archetype (VehicleLaunchData, the runtime event component Game.Events.VehicleLaunch and TargetElement), and writes the chosen transport type into the VehicleLaunchData component when the prefab entity is initialized.
Fields
public TransportType m_TransportType
Holds the transport category to use for this vehicle-launch event (e.g., Bus, Train, etc.). This value is copied into the runtime VehicleLaunchData when the prefab entity is initialized.
Properties
- None
Constructors
public VehicleLaunch()
Default constructor (compiler-provided). The component is generally configured in the editor (m_TransportType) rather than via constructor parameters.
Methods
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds component types that should exist on the prefab representation. Implementation adds:-
VehicleLaunchData
(read/write) — the data component that stores the configured transport type for runtime. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Adds component types that should be present on the instantiated archetype (entity created at runtime). Implementation adds: Game.Events.VehicleLaunch
(read/write) — the runtime event component used by the event system.-
TargetElement
(read/write) — used to hold target information for the event. -
public override void Initialize(EntityManager entityManager, Entity entity)
Called when the prefab is initialized into an entity. This method: - Calls the base Initialize.
- Creates a VehicleLaunchData struct, sets its m_TransportType field from this component's m_TransportType, and writes it to the entity via entityManager.SetComponentData(entity, componentData).
Usage Example
// This mirrors how the component writes configuration into the runtime component data.
public override void Initialize(EntityManager entityManager, Entity entity)
{
base.Initialize(entityManager, entity);
VehicleLaunchData componentData = default(VehicleLaunchData);
componentData.m_TransportType = m_TransportType;
entityManager.SetComponentData(entity, componentData);
}
Additional notes: - Related types: VehicleLaunchData, Game.Events.VehicleLaunch, TargetElement, TransportType, EventPrefab, ComponentBase. - This component is primarily used in prefab authoring to configure event behavior; runtime logic responds to the runtime Game.Events.VehicleLaunch component and the VehicleLaunchData stored on the entity.