Game.Pathfind.PathElementFlags
Assembly: Assembly-CSharp.dll
Namespace: Game.Pathfind
Type: enum (flags, underlying type: byte)
Base: System.Enum (underlying type: System.Byte)
Summary:
PathElementFlags is a [Flags] enum used by the pathfinding system to annotate individual elements (nodes/steps) of a computed path. Each flag represents a boolean attribute of a path element (for example, whether it is the path start, a waiting position, or part of a return/secondary route). Because the underlying type is byte, the enum is compact and intended for bitwise operations when building or interpreting paths.
Fields
-
Secondary = 1
Marks the element as a secondary path element (value: 1, 0x01). Often used to distinguish alternate or less-preferred segments. -
PathStart = 2
Marks the element as the starting point of a path (value: 2, 0x02). -
Action = 4
Indicates the element involves an action (value: 4, 0x04). Action could be special behavior associated with that path element. -
Return = 8
Marks the element as part of a return route/leg (value: 8, 0x08). -
Reverse = 0x10
Indicates the element should be traversed in reverse or is oriented opposite to the main direction (value: 16, 0x10). -
WaitPosition = 0x20
Marks the element as a waiting position where the agent should pause (value: 32, 0x20). -
Leader = 0x40
Marks the element as belonging to a leader or as a leader-designated node in group movement (value: 64, 0x40). -
Hangaround = 0x80
Indicates the element is a "hang around" spot — a place where agents may loiter or idle (value: 128, 0x80).
Properties
- None.
This is a plain enum type with no additional properties.
Constructors
- None (implicit default).
As an enum, PathElementFlags has the implicit default constructor provided by the runtime. You typically compose values using bitwise operators rather than constructing instances.
Methods
- None declared on the enum itself.
Use standard bitwise operations and Enum/extension helpers (e.g., Enum.HasFlag or (flags & PathElementFlags.SomeFlag) != 0) to inspect or modify flag values.
Usage Example
// Combine flags
PathElementFlags flags = PathElementFlags.PathStart | PathElementFlags.Leader;
// Check a flag using bitwise operator (preferred for performance in hot code paths)
bool isLeader = (flags & PathElementFlags.Leader) != 0;
// Or using HasFlag (less efficient due to boxing for enums)
bool isStart = flags.HasFlag(PathElementFlags.PathStart);
// Set an additional flag
flags |= PathElementFlags.WaitPosition;
// Clear a flag
flags &= ~PathElementFlags.Leader;
// Example: test for multiple flags
bool isStartAndWait = (flags & (PathElementFlags.PathStart | PathElementFlags.WaitPosition))
== (PathElementFlags.PathStart | PathElementFlags.WaitPosition);
// Casting to byte when storing/serializing
byte raw = (byte)flags;
PathElementFlags restored = (PathElementFlags)raw;
{{ Additional notes: - Because the enum uses the [Flags] attribute and an underlying byte, prefer bitwise operations for speed and compact storage (important in performance-sensitive pathfinding code). - When adding new flags, ensure they are unique powers of two and do not exceed 0x80 for the underlying byte (or change the underlying type if more bits are required). - Common usage locations: path construction, node annotations, group/leader movement logic, and serialization of path data. }}