Game.Pathfind.EdgeFlags
Assembly:
Namespace: Game.Pathfind
Type: public enum
Base: System.Enum (underlying type: System.UInt16)
Summary:
EdgeFlags is a bitmask enum (marked with [Flags]) used by the pathfinding system to describe properties and permissions of an edge (connection) between pathfinding nodes. Flags cover directionality (forward/backward), special secondary-edge markers, permission to enter/exit, free movement flags, outside-connection marker, authorization requirement, and a DefaultMask to represent the usual permitted bits. Values are stored in a 16-bit unsigned integer.
Fields
-
Forward = 1
Indicates the edge is traversable in the forward direction. -
Backward = 2
Indicates the edge is traversable in the backward direction. -
AllowMiddle = 4
Allows passing through the middle (used by mid-edge routing behavior). -
SingleOnly = 8
Restricts use to single-only behavior (typically used to indicate non-duplicable or single-lane usage). -
SecondaryStart = 0x10
Marks the edge as the start of a secondary segment (used for complex/secondary routing logic). -
SecondaryEnd = 0x20
Marks the edge as the end of a secondary segment. -
FreeForward = 0x40
Indicates free movement in the forward direction (often used for relaxed restrictions). -
FreeBackward = 0x80
Indicates free movement in the backward direction. -
Secondary = 0x100
Marks the edge as secondary (a general secondary indicator). -
AllowEnter = 0x200
Permits entering the edge (used to control whether pathfinding may move onto the edge). -
AllowExit = 0x400
Permits exiting the edge (used to control whether pathfinding may leave the edge). -
RequireAuthorization = 0x4000
Edge requires authorization (e.g., vehicle/person must be authorized to use this edge). -
OutsideConnection = 0x8000
Marks the edge as a connection to an outside/external network. -
DefaultMask = 0xFEFF
A mask representing the default allowed bits. In this value bit 0x0100 (Secondary) is cleared (0xFEFF == 0xFFFF & ~0x0100), so applying this mask typically removes the Secondary flag while preserving other bits.
Properties
- This enum type does not declare properties. It is a set of named constant values used as bit flags.
Constructors
- Enums do not declare constructors in user code. The EdgeFlags values are compile-time constants with an underlying System.UInt16 storage.
Methods
- This enum does not declare methods. Common operations are performed using bitwise operators or System.Enum.HasFlag.
Usage Example
// Combine flags
EdgeFlags flags = EdgeFlags.Forward | EdgeFlags.AllowEnter;
// Test a single flag (bitwise)
bool canEnter = (flags & EdgeFlags.AllowEnter) != 0;
// Test using HasFlag (boxed, slightly slower)
bool canGoBackward = flags.HasFlag(EdgeFlags.Backward);
// Apply the default mask to clear the Secondary bit if present
EdgeFlags filtered = flags & (EdgeFlags)EdgeFlags.DefaultMask;
// Check for special markers
if ((flags & EdgeFlags.RequireAuthorization) != 0) {
// perform authorization check
}
if ((flags & EdgeFlags.OutsideConnection) != 0) {
// treat as external connection
}