Skip to content

Game.Prefabs.VehicleSideEffectData

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: struct

Base: System.ValueType, IComponentData, IQueryTypeParameter, ISerializable

Summary:
Stores an axis-aligned side-effect volume for a vehicle prefab (minimum and maximum corners). This struct is an ECS component (IComponentData) and can be used as a query parameter (IQueryTypeParameter). It implements Colossal.Serialization.Entities.ISerializable so it can be written to / read from prefab serialization streams. The two float3 fields represent the local-space minimum and maximum corners of the side-effect bounding box (e.g., particle/emission/spawn extents).


Fields

  • public Unity.Mathematics.float3 m_Min
    {{ Represents the local-space minimum corner of the side-effect AABB. Typically the smaller coordinate values on each axis. Default (zero) when the struct is default-initialized. Used to define the lower bound of the volume in which side effects occur. }}

  • public Unity.Mathematics.float3 m_Max
    {{ Represents the local-space maximum corner of the side-effect AABB. Typically the larger coordinate values on each axis. Default (zero) when the struct is default-initialized. Used to define the upper bound of the volume in which side effects occur. }}

Properties

{{ This type does not declare any C# properties. The data is exposed via the two public fields m_Min and m_Max. }}

Constructors

  • public VehicleSideEffectData()
    {{ Implicit default constructor provided by the struct. When default-initialized, m_Min and m_Max will be float3.zero. You can create and initialize an instance with an object initializer to set the bounds. }}

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    {{ Writes the component data to the provided writer in the order: m_Min then m_Max. Intended for prefab/asset serialization via Colossal.Serialization.Entities writers. Each float3 is written using the writer's support for float3 types. }}

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    {{ Reads the component data from the provided reader into m_Min then m_Max (reads in the same order as Serialize). Uses ref assignments into the struct fields. Intended for prefab/asset deserialization via Colossal.Serialization.Entities readers. }}

Usage Example

// Example: creating the component and attaching to an entity (ECS)
var sideEffect = new Game.Prefabs.VehicleSideEffectData {
    m_Min = new Unity.Mathematics.float3(-1f, 0f, -1f),
    m_Max = new Unity.Mathematics.float3(1f, 2f, 1f)
};

// Using EntityManager to add the component to an entity:
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = entityManager.CreateEntity();
entityManager.AddComponentData(entity, sideEffect);

// Example: serializing the component to a writer (pseudo-code, writer type depends on serializer)
void WriteComponent<TWriter>(TWriter writer, Game.Prefabs.VehicleSideEffectData data) where TWriter : Colossal.Serialization.Entities.IWriter
{
    data.Serialize(writer);
}

// Example: deserializing the component from a reader (pseudo-code)
Game.Prefabs.VehicleSideEffectData ReadComponent<TReader>(TReader reader) where TReader : Colossal.Serialization.Entities.IReader
{
    var data = new Game.Prefabs.VehicleSideEffectData();
    data.Deserialize(reader);
    return data;
}