A* Pathfinding Project  3.7.3
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
GridNodeBase Class Reference

Base class for GridNode and LevelGridNode. More...

Detailed Description

Base class for GridNode and LevelGridNode.

Protected Member Functions

 GridNodeBase (AstarPath astar)
 
- Protected Member Functions inherited from GraphNode
 GraphNode (AstarPath astar)
 Constructor for a graph node.
 

Protected Attributes

int nodeInGridIndex
 
- Protected Attributes inherited from GraphNode
uint flags
 

Properties

int NodeInGridIndex [get, set]
 The index of the node in the grid.
 
- Properties inherited from GraphNode
uint Area [get, set]
 
bool Destroyed [get]
 
uint Flags [get, set]
 Holds various bitpacked variables.
 
uint GraphIndex [get, set]
 
int NodeIndex [get]
 Internal unique index.
 
uint Penalty [get, set]
 Penalty cost for walking on this node.
 
uint Tag [get, set]
 
bool Walkable [get, set]
 True if the node is traversable.
 

Additional Inherited Members

- Public Member Functions inherited from GraphNode
abstract void AddConnection (GraphNode node, uint cost)
 
abstract void ClearConnections (bool alsoReverse)
 Remove all connections from this node.
 
virtual bool ContainsConnection (GraphNode node)
 Checks if this node has a connection to the specified node.
 
virtual void DeserializeNode (GraphSerializationContext ctx)
 
virtual void DeserializeReferences (GraphSerializationContext ctx)
 Used to deserialize references to other nodes e.g connections.
 
void Destroy ()
 Destroys the node.
 
virtual void FloodFill (Stack< GraphNode > stack, uint region)
 
abstract void GetConnections (GraphNodeDelegate del)
 Calls the delegate with all connections from this node.
 
virtual bool GetPortal (GraphNode other, List< Vector3 > left, List< Vector3 > right, bool backwards)
 Add a portal from this node to the specified node.
 
abstract void Open (Path path, PathNode pathNode, PathHandler handler)
 Open the node.
 
virtual void RecalculateConnectionCosts ()
 Recalculates all connection costs from this node.
 
abstract void RemoveConnection (GraphNode node)
 
virtual void SerializeNode (GraphSerializationContext ctx)
 
virtual void SerializeReferences (GraphSerializationContext ctx)
 Used to serialize references to other nodes e.g connections.
 
void UpdateG (Path path, PathNode pathNode)
 
virtual void UpdateRecursiveG (Path path, PathNode pathNode, PathHandler handler)
 
- Public Attributes inherited from GraphNode
const uint MaxAreaIndex = FlagsAreaMask >> FlagsAreaOffset
 
const uint MaxGraphIndex = FlagsGraphMask >> FlagsGraphOffset
 Max number of graphs-1.
 
Int3 position
 

Constructor & Destructor Documentation

GridNodeBase ( AstarPath  astar)
protected

Member Data Documentation

int nodeInGridIndex
protected

Property Documentation

int NodeInGridIndex
getset

The index of the node in the grid.

This is x + z*graph.width (+ y*graph.width*graph.depth if this is a LayerGridGraph) So you can get the X and Z indices using

int index = node.NodeInGridIndex;
int x = index % graph.width;
int z = index / graph.width;
// where graph is GridNode.GetGridGraph (node.graphIndex), i.e the graph the nodes are contained in.

The documentation for this class was generated from the following file: