Skip to content

Game.Events.VehicleLaunch

Assembly:
Assembly-CSharp (game assembly)

Namespace:
Game.Events

Type:
struct

Base:
System.ValueType
Implements: IComponentData, IQueryTypeParameter, Colossal.Serialization.Entities.ISerializable

Summary:
Represents a lightweight ECS component used to signal a vehicle launch event. The component stores a set of flags (VehicleLaunchFlags) that describe how the vehicle should be launched. It is serializable to the Colossal serialization system so the flag state can be saved/restored or transmitted as needed by the game's systems.


Fields

  • public VehicleLaunchFlags m_Flags
    Stores the launch options as a flags enum. This field controls launch behavior (the exact meanings depend on the VehicleLaunchFlags enum). When not explicitly set the default value is 0. The value is written/read as an unsigned integer during serialization.

Properties

  • None. This struct exposes a public field only; there are no C# properties defined.

Constructors

  • None explicitly defined. Uses the default parameterless struct constructor (all fields default-initialized).

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the m_Flags field to the provided writer as a uint. Used by the Colossal serialization pipeline to persist or transmit the component state.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads a uint value from the provided reader and casts it back to VehicleLaunchFlags, restoring the component's state during deserialization.

Usage Example

// Add the component to an entity with a specific flag value
var launch = new Game.Events.VehicleLaunch {
    m_Flags = VehicleLaunchFlags.SomeFlag | VehicleLaunchFlags.AnotherFlag
};
entityManager.AddComponentData(vehicleEntity, launch);

// Example of manual serialization (illustrative; real usage follows game's serialization pipeline)
using (var writer = /* obtain a writer from the game's serialization system */)
{
    launch.Serialize(writer);
}

// During load/receive:
var loaded = new Game.Events.VehicleLaunch();
using (var reader = /* obtain a reader from the game's serialization system */)
{
    loaded.Deserialize(reader);
}

Notes: - VehicleLaunchFlags is an enum (flags) defined elsewhere; consult its definition for available flag values and meanings. - This struct is designed for the Unity.Entities ECS in Cities: Skylines 2 and integrates with the game's (Colossal) serialization interfaces.