Skip to content

Game.Routes.CurveElement

Assembly: Game
Namespace: Game.Routes

Type: struct

Base: IBufferElementData, IEmptySerializable

Summary:
Represents a single buffer element that stores a Bezier4x3 curve. This struct is intended for use as an ECS dynamic buffer element (DynamicBuffer) to hold route/curve data (for example, segments of road/route geometry). The type is marked with [InternalBufferCapacity(0)], indicating there is no inline static capacity for the buffer—elements are stored dynamically. Implementing IEmptySerializable indicates it participates in the game's custom serialization system.


Fields

  • public Bezier4x3 m_Curve
    Holds the Bezier4x3 curve data for this element. The Bezier4x3 type (from Colossal.Mathematics) encodes the 4 control points/coefficients for a 3D cubic Bezier curve used by routing/geometry code.

Properties

  • None. This struct only exposes the public field m_Curve.

Constructors

  • public CurveElement()
    No explicit constructors are defined in the source — the default value-type constructor is used. Initialize by assigning m_Curve when adding elements to a buffer.

Methods

  • None.

Usage Example

// Example: create an entity, add a DynamicBuffer<CurveElement>, and append a curve element
var entityManager = Unity.Entities.World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = entityManager.CreateEntity();

// Add a dynamic buffer of CurveElement to the entity
var buffer = entityManager.AddBuffer<Game.Routes.CurveElement>(entity);

// Obtain or construct a Bezier4x3 instance (implementation-specific)
Bezier4x3 myBezier = /* construct or retrieve a Bezier4x3 */;

// Add a curve element to the buffer
buffer.Add(new Game.Routes.CurveElement { m_Curve = myBezier });

{{ Additional notes: - Use DynamicBuffer when storing sequences of Bezier curves per entity (e.g., lanes, route segments). - The [InternalBufferCapacity(0)] attribute means the buffer has no preallocated inline capacity; consider this for performance/packing decisions. - IEmptySerializable is part of the game's serialization utilities—this struct will participate in entity serialization/deserialization handled by the engine. }}