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

Public Member Functions

void AddNeighboursRec (List< QuadtreeNode > arr, QuadtreeNodeHolder holder, int depth, int x, int y, IntRect bounds, QuadtreeNode dontInclude)
 
bool CheckCollision (int x, int y)
 
int CheckNode (int xs, int ys, int width)
 
void CreateNodeRec (QuadtreeNodeHolder holder, int depth, int x, int y)
 
void DrawRec (QuadtreeNodeHolder h, int depth, int x, int y, Vector3 parentPos)
 
override void GetNodes (GraphNodeDelegateCancelable del)
 Calls a delegate with all nodes in the graph.
 
Vector3 LocalToWorldPosition (int x, int y, int width)
 
override void OnDrawGizmos (bool drawNodes)
 Draw gizmos for the graph.
 
QuadtreeNode QueryPoint (int qx, int qy)
 
void RecalculateConnections (QuadtreeNodeHolder holder, int depth, int x, int y)
 
void RecalculateConnectionsRec (QuadtreeNodeHolder holder, int depth, int x, int y)
 
override IEnumerable< ProgressScanInternal ()
 Internal method to scan the graph.
 
void ScanInternal (OnScanStatus statusCallback)
 
- Public Member Functions inherited from NavGraph
virtual void Awake ()
 This will be called on the same time as Awake on the gameObject which the AstarPath script is attached to.
 
virtual int CountNodes ()
 Number of nodes in the graph.
 
virtual void DeserializeExtraInfo (GraphSerializationContext ctx)
 Deserializes graph type specific node data.
 
virtual void DeserializeSettingsCompatibility (GraphSerializationContext ctx)
 An old format for serializing settings.
 
NNInfoInternal GetNearest (Vector3 position)
 Returns the nearest node to a position using the default NNConstraint.
 
NNInfoInternal GetNearest (Vector3 position, NNConstraint constraint)
 Returns the nearest node to a position using the specified NNConstraint.
 
virtual NNInfoInternal GetNearest (Vector3 position, NNConstraint constraint, GraphNode hint)
 Returns the nearest node to a position using the specified NNConstraint.
 
virtual NNInfoInternal GetNearestForce (Vector3 position, NNConstraint constraint)
 Returns the nearest node to a position using the specified constraint .
 
virtual Color NodeColor (GraphNode node, PathHandler data)
 Color to use for gizmos.
 
virtual void OnDestroy ()
 Function for cleaning up references.
 
virtual void PostDeserialization ()
 Called after all deserialization has been done for all graphs.
 
virtual void RelocateNodes (Matrix4x4 oldMatrix, Matrix4x4 newMatrix)
 Relocates the nodes in this graph.
 
void Scan ()
 
void ScanGraph ()
 Partially scan the graph.
 
virtual void SerializeExtraInfo (GraphSerializationContext ctx)
 Serializes graph type specific node data.
 
void SetMatrix (Matrix4x4 m)
 Use to set both matrix and inverseMatrix at the same time.
 

Public Attributes

Vector3 center
 
int editorHeightLog2 = 6
 
int editorWidthLog2 = 6
 
LayerMask layerMask = -1
 
int minDepth = 3
 
float nodeSize = 1
 
- Public Attributes inherited from NavGraph
AstarPath active
 Reference to the AstarPath object in the scene.
 
bool drawGizmos = true
 Enable to draw gizmos in the Unity scene view.
 
uint graphIndex
 Index of the graph, used for identification purposes.
 
Guid guid
 Used as an ID of the graph, considered to be unique.
 
bool infoScreenOpen
 Used in the editor to check if the info screen is open.
 
uint initialPenalty
 Default penalty to apply to all nodes.
 
Matrix4x4 inverseMatrix = Matrix4x4.identity
 Inverse of matrix.
 
Matrix4x4 matrix = Matrix4x4.identity
 A matrix for translating/rotating/scaling the graph.
 
string name
 Name of the graph.
 
bool open
 Is the graph open in the editor.
 

Properties

int Height [get, set]
 
int Width [get, set]
 

Private Attributes

BitArray map
 
QuadtreeNodeHolder root
 

Additional Inherited Members

- Static Public Member Functions inherited from NavGraph
static bool InSearchTree (GraphNode node, Path path)
 Returns if the node is in the search tree of the path.
 
- Package Functions inherited from NavGraph
virtual void UnloadGizmoMeshes ()
 Called when temporary meshes used in OnDrawGizmos need to be unloaded to prevent memory leaks.
 

Member Function Documentation

void AddNeighboursRec ( List< QuadtreeNode arr,
QuadtreeNodeHolder  holder,
int  depth,
int  x,
int  y,
IntRect  bounds,
QuadtreeNode  dontInclude 
)
bool CheckCollision ( int  x,
int  y 
)
int CheckNode ( int  xs,
int  ys,
int  width 
)
void CreateNodeRec ( QuadtreeNodeHolder  holder,
int  depth,
int  x,
int  y 
)
void DrawRec ( QuadtreeNodeHolder  h,
int  depth,
int  x,
int  y,
Vector3  parentPos 
)
override void GetNodes ( GraphNodeDelegateCancelable  del)
virtual

Calls a delegate with all nodes in the graph.

This is the primary way of iterating through all nodes in a graph.

Do not change the graph structure inside the delegate.

myGraph.GetNodes (node => {
Debug.Log ("I found a node at position " + (Vector3)node.Position);
return true;
});

Implements NavGraph.

Vector3 LocalToWorldPosition ( int  x,
int  y,
int  width 
)
override void OnDrawGizmos ( bool  drawNodes)
virtual

Draw gizmos for the graph.

Reimplemented from NavGraph.

QuadtreeNode QueryPoint ( int  qx,
int  qy 
)
void RecalculateConnections ( QuadtreeNodeHolder  holder,
int  depth,
int  x,
int  y 
)
void RecalculateConnectionsRec ( QuadtreeNodeHolder  holder,
int  depth,
int  x,
int  y 
)
override IEnumerable<Progress> ScanInternal ( )
virtual

Internal method to scan the graph.

Called from AstarPath.ScanAsync. Override this function to implement custom scanning logic. Progress objects can be yielded to show progress info in the editor and to split up processing over several frames when using async scanning.

Implements NavGraph.

void ScanInternal ( OnScanStatus  statusCallback)

Member Data Documentation

Vector3 center
int editorHeightLog2 = 6
int editorWidthLog2 = 6
LayerMask layerMask = -1
BitArray map
private
int minDepth = 3
float nodeSize = 1
QuadtreeNodeHolder root
private

Property Documentation

int Height
getset
int Width
getset

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