Game.Simulation.ElectricityFlowEdgeFlags
Assembly: Assembly-CSharp
Namespace: Game.Simulation
Type: public enum ElectricityFlowEdgeFlags : byte
Base: System.Enum (underlying type: System.Byte)
Summary:
Flags enum used by the electricity simulation to annotate edges in the power-flow graph. Each enum value represents a state or characteristic of an electricity edge such as the direction of flow (forward/backward), whether the edge is a bottleneck or beyond a bottleneck, or whether it is disconnected. The [Flags] attribute allows combinations of these flags to represent multiple simultaneous states (for example Forward | Bottleneck). ForwardBackward is a convenience value combining Forward and Backward.
Fields
-
None = 0
No flags set. The edge has no special flow or connectivity status. -
Forward = 1
Flow is present in the forward direction along the edge. -
Backward = 2
Flow is present in the backward direction along the edge. -
Bottleneck = 4
The edge is identified as a bottleneck in the network (limiting capacity). -
BeyondBottleneck = 8
The edge lies beyond a bottleneck relative to a flow path. -
Disconnected = 0x10
The edge is disconnected from the network (no flow). -
ForwardBackward = 3
Convenience value equal to Forward | Backward (1 | 2). Indicates flow in both directions.
Properties
- This enum type has no properties. Use bitwise operations or Enum.HasFlag to inspect combined flags.
Constructors
- Enums do not expose constructors. Values are assigned as constants.
Methods
- No methods are defined on this enum. Typical operations are performed with bitwise operators or helper methods (e.g., HasFlag).
Usage Example
// Mark an edge as forwarding flow and a bottleneck
ElectricityFlowEdgeFlags flags = ElectricityFlowEdgeFlags.Forward | ElectricityFlowEdgeFlags.Bottleneck;
// Check for a specific flag
bool isForward = (flags & ElectricityFlowEdgeFlags.Forward) != 0;
// or
bool isBottleneck = flags.HasFlag(ElectricityFlowEdgeFlags.Bottleneck);
// Combine flags to represent both directions
flags |= ElectricityFlowEdgeFlags.Backward; // now flags includes ForwardBackward
// Clear a flag
flags &= ~ElectricityFlowEdgeFlags.Bottleneck;
// Test disconnected
if ((flags & ElectricityFlowEdgeFlags.Disconnected) == ElectricityFlowEdgeFlags.Disconnected)
{
// handle disconnected edge
}