A* Pathfinding Project  3.1.4
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Enumerations Properties Groups Pages
GridNode Class Reference
+ Inheritance diagram for GridNode:
+ Collaboration diagram for GridNode:

Public Member Functions

override void FloodFill (Stack< Node > stack, int area)
 Adds all connecting nodes to the stack and sets the area variable to area.
 
bool GetConnection (int i)
 Has connection to neighbour i.
 
override void GetConnections (NodeDelegate callback)
 Get all connections for a node.
 
int GetGridIndex ()
 Returns index of which GridGraph this node is contained in.
 
int GetIndex ()
 Returns the grid index in the graph.
 
bool HasAnyGridConnections ()
 Returns if this node has any valid grid connections.
 
override int[] InitialOpen (BinaryHeapM open, Int3 targetPosition, Int3 position, Path path, bool doOpen)
 
override void Open (NodeRunData nodeRunData, NodeRun nodeR, Int3 targetPosition, Path path)
 
override bool RemoveConnection (Node node)
 Removes a connection from the node.
 
void SetConnection (int i, int value)
 Set connection to neighbour i.
 
void SetConnectionRaw (int i, int value)
 Sets a connection without clearing the previous value.
 
void SetGridIndex (int gridIndex)
 Sets the index of which GridGraph this node is contained in.
 
void SetIndex (int i)
 Set the grid index in the graph.
 
override void UpdateAllG (NodeRun nodeR, NodeRunData nodeRunData)
 
override void UpdateConnections ()
 Remove connections to unwalkable nodes.
 
void UpdateGridConnections ()
 Updates the grid connections of this node and it's neighbour nodes to reflect walkability of this node.
 
- Public Member Functions inherited from Node
void AddConnection (Node node, int cost)
 Add a connection to the node with the specified cost.
 
void BaseFloodFill (Stack< Node > stack, int area)
 Adds all connecting nodes to the stack and sets the area variable to area.
 
int[] BaseInitialOpen (BinaryHeapM open, Int3 targetPosition, Int3 position, Path path, bool doOpen)
 
void BaseOpen (NodeRunData nodeRunData, NodeRun nodeR, Int3 targetPosition, Path path)
 Opens the nodes connected to this node.
 
void BaseResetCosts (int[] costs)
 Resets the costs modified by the InitialOpen function when 'doOpen' was false (for the end node).
 
virtual bool ContainsConnection (Node node)
 Returns true if this node has a connection to the node.
 
void GetConnectionsBase (NodeDelegate callback)
 Get all connections for a node.
 
int GetNodeIndex ()
 Returns the global node index.
 
void RecalculateConnectionCosts (bool neighbours)
 Recalculate costs for each connection.
 
virtual void ResetCosts (int[] costs)
 Resets the costs modified by the InitialOpen function when 'doOpen' was false (for the end node).
 
void SetNodeIndex (int index)
 
void UpdateG (NodeRun nodeR, NodeRunData nodeRunData)
 
void UpdateH (Int3 targetPosition, Heuristic heuristic, float scale, NodeRun nodeR)
 Calculates and updates the H score.
 
virtual void UpdateNeighbourConnections ()
 Calls UpdateConnections on all neighbours.
 

Static Public Member Functions

static void RemoveGridGraph (GridGraph graph)
 
static int SetGridGraph (GridGraph graph)
 
- Static Public Member Functions inherited from Node
static int Abs (int x)
 Implementation of the Absolute function.
 

Static Public Attributes

static GridGraph[] gridGraphs
 Internal list of grid graphs.
 

Protected Attributes

int indices
 First 24 bits used for the index value of this node in the graph specified by the last 8 bits.
 

Properties

bool WalkableErosion [get, set]
 Returns if walkable before erosion.
 
- Properties inherited from Node
int area [get, set]
 Area ID of the node.
 
bool Bit15 [get, set]
 Returns bit 15 from flags.
 
bool Bit16 [get, set]
 Returns bit 16 from flags.
 
bool Bit8 [get, set]
 Returns bit 8 from flags.
 
int graphIndex [get, set]
 The index of the graph this node is in.
 
uint penalty [get, set]
 
int tags [get, set]
 Tags for walkability.
 
bool walkable [get, set]
 Is the node walkable.
 

Additional Inherited Members

- Public Attributes inherited from Node
int[] connectionCosts
 Cost for the connections to other nodes.
 
Node[] connections
 List of all connections from this node.
 
int flags
 Bit packed values for different fields.
 
Int3 position
 Position in world space of the node.
 
- Protected Member Functions inherited from Node
void BaseUpdateAllG (NodeRun nodeR, NodeRunData nodeRunData)
 

Member Function Documentation

bool GetConnection ( int  i)

Has connection to neighbour i.

The neighbours are the up to 8 grid neighbours of this node.

See Also
SetConnection

+ Here is the caller graph for this function:

override void GetConnections ( NodeDelegate  callback)
virtual

Get all connections for a node.

This function will call the callback with every node this node is connected to. In contrast to the connections array this function also includes custom connections which for example grid graphs use.

Since
Added in version 3.2

Reimplemented from Node.

override bool RemoveConnection ( Node  node)
virtual

Removes a connection from the node.

This can be a standard connection or a grid connection

Returns
True if a connection was removed, false otherwsie

Reimplemented from Node.

+ Here is the call graph for this function:

void SetConnection ( int  i,
int  value 
)

Set connection to neighbour i.

Parameters
iConnection to set [0...7]
value1 or 0 (true/false) The neighbours are the up to 8 grid neighbours of this node
See Also
GetConnection
void SetConnectionRaw ( int  i,
int  value 
)

Sets a connection without clearing the previous value.

Faster if you are setting all connections at once and have cleared the value before calling this function

See Also
SetConnection

+ Here is the caller graph for this function:

void SetGridIndex ( int  gridIndex)

Sets the index of which GridGraph this node is contained in.

Only changes lookup variables, does not actually move the node to another graph.

+ Here is the caller graph for this function:

override void UpdateConnections ( )
virtual

Remove connections to unwalkable nodes.

This function loops through all connections and removes the ones which lead to unwalkable nodes.
This can speed up performance if a lot of nodes have connections to unwalkable nodes, they usually don't though

Note
This function does not add connections which might have been removed previously

Reimplemented from Node.

Member Data Documentation

GridGraph [] gridGraphs
static

Internal list of grid graphs.

Used for fast typesafe lookup of graphs.

int indices
protected

First 24 bits used for the index value of this node in the graph specified by the last 8 bits.

See Also
gridGraphs

Property Documentation

bool WalkableErosion
getset

Returns if walkable before erosion.

Identical to Pathfinding::Node::Bit15 but should be used when possible to make the code more readable


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