A* Pathfinding Project  4.1.13
The A* Pathfinding Project for Unity 3D
PathHandler Class Reference

Handles thread specific path data. More...

Detailed Description

Handles thread specific path data.

See also
PathNode

Public Member Functions

 PathHandler (int threadID, int totalThreadCount)
 
void ClearPathIDs ()
 Set all nodes' pathIDs to 0. More...
 
virtual void DestroyNode (GraphNode node)
 Internal method to clean up node data. More...
 
virtual void GetAllPathNodes (GraphNode node, System.Action< PathNode > action)
 Calls a delegate with all path nodes associated with the specified node. More...
 
virtual PathNode GetPathNode (int nodeIndex)
 Path node associated with the specified node. More...
 
virtual PathNode GetPathNode (GraphNode node)
 Returns the PathNode corresponding to the specified node. More...
 
void InitializeForPath (Path p)
 
virtual void InitializeNode (GraphNode node)
 Internal method to initialize node data. More...
 

Public Attributes

readonly System.Text.StringBuilder DebugStringBuilder = new System.Text.StringBuilder()
 StringBuilder that paths can use to build debug strings. More...
 
readonly BinaryHeap heap = new BinaryHeap(128)
 Binary heap to keep track of nodes on the "Open list". More...
 
PathNode [] nodes = new PathNode[0]
 Array of all PathNodes. More...
 
readonly int threadID
 
readonly int totalThreadCount
 

Properties

ushort PathID [get, private set]
 ID for the path currently being calculated or last path that was calculated. More...
 

Constructor & Destructor Documentation

◆ PathHandler()

PathHandler ( int  threadID,
int  totalThreadCount 
)

Member Function Documentation

◆ ClearPathIDs()

void ClearPathIDs ( )

Set all nodes' pathIDs to 0.

See also
Pathfinding.PathNode.pathID

◆ DestroyNode()

virtual void DestroyNode ( GraphNode  node)
virtual

Internal method to clean up node data.

Reimplemented in CooperativePathHandler.

◆ GetAllPathNodes()

virtual void GetAllPathNodes ( GraphNode  node,
System.Action< PathNode action 
)
virtual

Calls a delegate with all path nodes associated with the specified node.

The default path handler only has one PathNode per GraphNode, but other path handlers may have more (e.g the CooperativePathHandler)

Reimplemented in CooperativePathHandler.

◆ GetPathNode() [1/2]

virtual PathNode GetPathNode ( int  nodeIndex)
virtual

Path node associated with the specified node.

The default path handler only has one PathNode per GraphNode, but other path handlers may have more (e.g the CooperativePathHandler).

The PathNode is specific to this PathHandler since multiple PathHandlers are used at the same time if multithreading is enabled.

See also
GetAllPathNodes

Reimplemented in CooperativePathHandler.

◆ GetPathNode() [2/2]

virtual PathNode GetPathNode ( GraphNode  node)
virtual

Returns the PathNode corresponding to the specified node.

The PathNode is specific to this PathHandler since multiple PathHandlers are used at the same time if multithreading is enabled.

Reimplemented in CooperativePathHandler.

◆ InitializeForPath()

void InitializeForPath ( Path  p)

◆ InitializeNode()

virtual void InitializeNode ( GraphNode  node)
virtual

Internal method to initialize node data.

Reimplemented in CooperativePathHandler.

Member Data Documentation

◆ DebugStringBuilder

readonly System.Text.StringBuilder DebugStringBuilder = new System.Text.StringBuilder()

StringBuilder that paths can use to build debug strings.

Better for performance and memory usage to use a single StringBuilder instead of each path creating its own

◆ heap

readonly BinaryHeap heap = new BinaryHeap(128)

Binary heap to keep track of nodes on the "Open list".

See also
https://en.wikipedia.org/wiki/A*_search_algorithm

◆ nodes

PathNode [] nodes = new PathNode[0]

Array of all PathNodes.

◆ threadID

readonly int threadID

◆ totalThreadCount

readonly int totalThreadCount

Property Documentation

◆ PathID

ushort PathID
getprivate set

ID for the path currently being calculated or last path that was calculated.


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