Skip to content

Game.Net.EdgeGeometry

Assembly: Assembly-CSharp
Namespace: Game.Net

Type: struct

Base: System.ValueType
Implements: IComponentData, IQueryTypeParameter, IEmptySerializable

Summary: Represents the geometric information for an edge between two network segments. This lightweight struct is intended to be used as an ECS component (Unity.Entities.IComponentData) for storing start/end segment identifiers (Colossal.Mathematics.Segment) and a 3D bounding volume (Colossal.Mathematics.Bounds3) useful for spatial queries, culling, and collision/interaction logic in network-related systems in Cities: Skylines 2. The type is blittable and designed for fast use in jobs and entity queries.


Fields

  • public Segment m_Start
    Represents the segment at the start of the edge. Segment is a compact Colossal.Mathematics type used by the game to identify and describe a network segment (often encodes endpoints/indices and other packed data). This field denotes the segment on one side of the edge.

  • public Segment m_End
    Represents the segment at the end of the edge. Functions as the counterpart to m_Start to define the edge between two segments.

  • public Bounds3 m_Bounds
    A 3D bounding volume (Colossal.Mathematics.Bounds3) that encloses the edge geometry. Used for spatial tests such as frustum culling, overlap queries, or broad-phase collision checks to quickly rule out or include this edge in further processing.

Properties

  • This type defines no properties. It exposes plain public fields for direct, efficient access.

Constructors

  • public EdgeGeometry()
    Implicit default value-type constructor. All fields are initialized to their default values (Segment default, Bounds3 default). Create and populate explicitly when adding as a component to an entity.

Methods

  • This struct does not declare any instance methods. Behavior is purely data-oriented. Serialization/handling in the engine may be managed externally via the IEmptySerializable/IQueryTypeParameter semantics used by the game's systems.

Usage Example

using Colossal.Mathematics;
using Unity.Entities;
using Game.Net;

// Example: creating an entity and assigning EdgeGeometry
public void CreateEdgeEntity(EntityManager entityManager, Segment startSeg, Segment endSeg, Bounds3 bounds)
{
    var archetype = entityManager.CreateArchetype(typeof(EdgeGeometry));
    var entity = entityManager.CreateEntity(archetype);

    var edgeGeom = new EdgeGeometry
    {
        m_Start = startSeg,
        m_End = endSeg,
        m_Bounds = bounds
    };

    entityManager.SetComponentData(entity, edgeGeom);
}

// Example: reading EdgeGeometry inside a SystemBase
public partial class EdgeProcessingSystem : SystemBase
{
    protected override void OnUpdate()
    {
        Entities.ForEach((ref EdgeGeometry geom) =>
        {
            // Access geom.m_Start, geom.m_End and geom.m_Bounds here
            // Perform spatial checks, update debug visualization, etc.
        }).ScheduleParallel();
    }
}

Notes: - Because this is a value-type ECS component, prefer direct field access and use in jobs for best performance. - The exact internal layout/semantics of Colossal.Mathematics.Segment and Bounds3 are defined elsewhere in the game's math library; treat them as opaque geometric identifiers/containers unless you need their internals.