Game.Zones.CurvePosition
Assembly:
Assembly-CSharp (inferred — main game assembly)
Namespace: Game.Zones
Type:
struct
Base:
System.ValueType (implements Unity.Entities.IComponentData, IQueryTypeParameter, Colossal.Serialization.Entities.ISerializable)
Summary:
Lightweight ECS component that stores a 2D curve position using Unity.Mathematics.float2. Intended for use in zone/road/placement systems to record a position on a procedural curve (for example: parametric position along a spline and a lateral offset). The struct is serializable via the Colossal.Serialization.Entities system so it will be saved/loaded with entity data.
Fields
public Unity.Mathematics.float2 m_CurvePosition
Holds the curve position data. Interpretation is context-dependent (commonly: x = parameter along curve, y = lateral offset or secondary parameter). This field is written/read during serialization.
Properties
- (none)
Constructors
public CurvePosition()
Default parameterless struct constructor (value-type), initializes m_CurvePosition to float2(0,0). You can create an initialized instance using object initializer syntax:
var cp = new CurvePosition { m_CurvePosition = new float2(0.5f, 1.25f) };
Methods
-
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Serializes the m_CurvePosition field using the provided writer. The writer is expected to have an overload to write a float2. Used by the Colossal.Serialization.Entities pipeline to save component data. -
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Deserializes m_CurvePosition from the provided reader. The reader is expected to support reading a float2. Used by the Colossal.Serialization.Entities pipeline to restore component data.
Usage Example
// Add or set the component on an entity (requires using Unity.Entities and Unity.Mathematics)
var cp = new CurvePosition { m_CurvePosition = new float2(0.25f, 2.0f) };
entityManager.AddComponentData(entity, cp);
// Read component
var read = entityManager.GetComponentData<CurvePosition>(entity);
float2 pos = read.m_CurvePosition;
// The Serialize/Deserialize methods are invoked by the Colossal serialization system
// when saving/loading entity data; you normally don't call them directly.
{{ Additional notes: - Because this is an IComponentData struct, it is intended for use with Unity.Entities (ECS) and should be used in jobs/systems accordingly. - The exact semantic meaning of the two float components depends on the subsystem using this component (check callers/consumers if you need precise interpretation). - Ensure to include Unity.Mathematics when constructing float2 instances. }}