Game.HangingLane
Assembly: Assembly-CSharp
Namespace: Game.Net
Type: struct
Base: IComponentData, IQueryTypeParameter, ISerializable
Summary: Represents a lightweight component used by the game's ECS (Entity Component System) to store two distance values for a "hanging lane" concept (stored as a Unity.Mathematics.float2). Implements ISerializable so the component can be (de)serialized for networking or save/load purposes, and IQueryTypeParameter so it can be used in ECS query patterns.
Fields
public float2 m_Distances
Stores two distance values (x and y) related to the hanging lane. Uses Unity.Mathematics.float2; commonly interpreted as two float distance components (for example left/right or near/far offsets). The exact semantic depends on how the calling systems interpret those two components.
Properties
- This type defines no properties.
Constructors
public HangingLane()
No explicit constructors are defined in the source; the default parameterless value-type constructor is used. Initialize fields directly when creating instances (e.g., new HangingLane { m_Distances = new float2(x, y) }).
Methods
-
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
: System.Void
Writes the m_Distances field to the provided writer. Used by the Colossal.Serialization system for persisting or sending component data. -
public void Deserialize<TReader>(TReader reader) where TReader : IReader
: System.Void
Reads the m_Distances field from the provided reader. Restores the component state from serialized data.
Both methods are generic to accept the serialization abstractions used by the game's serialization framework.
Usage Example
using Unity.Entities;
using Unity.Mathematics;
using Game.Net;
// Create and set up a HangingLane component
var hanging = new HangingLane {
m_Distances = new float2(1.5f, 2.0f)
};
// Add to an entity via the EntityManager
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
EntityArchetype archetype = entityManager.CreateArchetype(typeof(HangingLane));
Entity e = entityManager.CreateEntity(archetype);
entityManager.SetComponentData(e, hanging);
// When serialization runs, the Serialize/Deserialize implementations
// will be invoked by the game's serialization layer that provides an IWriter/IReader.
{{ This struct is a simple POD (plain-old-data) ECS component intended for storage and serialization only. It contains no logic beyond reading/writing its float2 field. If you need semantic clarity on what each component of m_Distances represents, search for usages of HangingLane in the codebase (systems or writers/readers) to see how consuming systems interpret x and y. }}