Game.ConnectedFlowEdge
Assembly: Assembly-CSharp (game assembly — common for Cities: Skylines 2 mods)
Namespace: Game.Simulation
Type: struct (public) — implements IBufferElementData, IEmptySerializable, IEquatable
Base: System.ValueType (struct)
Summary:
Represents a single connected flow "edge" as a buffer element for Unity's ECS. This struct stores an Entity that identifies an edge in the game's flow/network simulation. It implements IBufferElementData so it can be stored in a DynamicBuffer, IEmptySerializable to participate in the game's/Colossal serialization system, and IEquatable to compare elements by their underlying Entity. The struct also provides an implicit conversion to Entity for convenient access to the stored Entity value.
Fields
public Unity.Entities.Entity m_Edge
Holds the Entity that represents the connected flow edge. This is the primary data carried by the buffer element and is used to identify/link the edge within simulation systems.
Properties
- (none)
There are no managed properties on this struct; the Entity is exposed directly via the public field m_Edge.
Constructors
public ConnectedFlowEdge(Unity.Entities.Entity edge)
Initializes a new ConnectedFlowEdge with the given Entity. Use this to create buffer elements that reference a particular edge Entity.
Methods
-
public bool Equals(ConnectedFlowEdge other)
Compares this element to another ConnectedFlowEdge by comparing their underlying Entity values. Returns true if both reference the same Entity. -
public override int GetHashCode()
Returns the hash code of the underlying Entity. Useful when using the struct in hashed collections or comparisons. -
public static implicit operator Unity.Entities.Entity(ConnectedFlowEdge element)
Implicitly converts a ConnectedFlowEdge to its underlying Unity.Entities.Entity, allowing the element to be used in contexts that expect an Entity (for example: Entity e = connectedFlowEdge;).
Notes: - As a struct, a default parameterless value exists (m_Edge will be default(Entity)) — be mindful of default/invalid Entities when reading from buffers. - IEmptySerializable is a marker used by Colossal.Serialization to support saving/loading of this element type.
Usage Example
// Add a ConnectedFlowEdge to a DynamicBuffer on some entity (e.g., a node or flow container)
var edgeEntity = /* obtain edge Entity from simulation */;
var buffer = EntityManager.GetBuffer<ConnectedFlowEdge>(someContainerEntity);
// Create via constructor
buffer.Add(new ConnectedFlowEdge(edgeEntity));
// Read and use implicit conversion to Entity
foreach (var elem in buffer)
{
Unity.Entities.Entity e = elem; // implicit conversion
// Use e with other ECS/system APIs...
}
// Compare elements
var a = new ConnectedFlowEdge(edgeEntity);
var b = new ConnectedFlowEdge(edgeEntity);
bool same = a.Equals(b); // true