Game.Pathfind.NodeID
Assembly: Assembly-CSharp
Namespace: Game.Pathfind
Type: struct
Base: System.ValueType, System.IEquatable
Summary:
Represents a lightweight identifier for a pathfinding node. This value type wraps a single integer index (m_Index) and implements IEquatable
Fields
public System.Int32 m_Index
Integer index that identifies the node. Equality and GetHashCode() are based on this value. Because there is no validation in this type, conventions for "invalid" indices (if any) are defined by the surrounding codebase, not by NodeID itself.
Properties
- None.
Constructors
public NodeID()
(implicit default)
Structs have an implicit parameterless constructor that initializes m_Index to 0. There are no explicit constructors defined in the source.
Methods
-
public System.Boolean Equals(Game.Pathfind.NodeID other)
Compares this NodeID with another by comparing their m_Index values. Returns true when the indices are equal. -
public override System.Int32 GetHashCode()
Returns the integer value of m_Index as the hash code. Note: because the hash code is the raw index, negative index values (if used) will be returned as-is; ensure this behavior is acceptable for any hash-based containers.
Usage Example
// create a NodeID and set its index
Game.Pathfind.NodeID id = new Game.Pathfind.NodeID { m_Index = 42 };
// compare two NodeID instances
Game.Pathfind.NodeID a = new Game.Pathfind.NodeID { m_Index = 5 };
Game.Pathfind.NodeID b = new Game.Pathfind.NodeID { m_Index = 5 };
bool equal = a.Equals(b); // true
// use as a key in a dictionary (hashing uses m_Index)
var dict = new System.Collections.Generic.Dictionary<Game.Pathfind.NodeID, string>();
dict[a] = "node 5";
string label = dict[a];