|
A* Pathfinding Project
3.0.9
The A* Pathfinding Project for Unity
|
Base class for all graphs. More...
Inheritance diagram for NavGraph:
Collaboration diagram for NavGraph:| virtual Node[] | CreateNodes (int number) | Creates a number of nodes with the correct type for the graph. | |
| virtual void | RelocateNodes (Matrix4x4 oldMatrix, Matrix4x4 newMatrix) | Relocates the nodes in this graph. | |
| NNInfo | GetNearest (Vector3 position) | Returns the nerest node to a position using the default constraint. | |
| virtual NNInfo | GetNearest (Vector3 position, NNConstraint constraint, Node hint=null) | Returns the nearest node to a position using the specified NNConstraint. | |
| virtual NNInfo | GetNearestForce (Vector3 position, NNConstraint constraint) | Returns the nearest node to a position using the specified constraint. | |
| virtual void | Awake () | This will be called on the same time as Awake on the gameObject which the AstarPath script is attached to. | |
| void | SafeOnDestroy () | SafeOnDestroy should be used when there is a risk that the pathfinding is searching through this graph when called. | |
| virtual void | OnDestroy () | Function for cleaning up references. | |
| void | ScanGraph () | Scanns the graph with appropriate pre and post processing calls. | |
| virtual void | Scan () | Scanns the graph, called from AstarPath.Scan Override this function to implement custom scanning logic. | |
| virtual Color | NodeColor (Node node) | Returns a color to be used for the specified node with the current debug settings (editor only) | |
| virtual void | OnDrawGizmos (bool drawNodes) |
| System.Guid | _guid = System.Guid.NewGuid () | See NavGraph.guid. | |
| byte[] | _sguid | See NavGraph.guid used to store the guid value. | |
| AstarPath | active | Reference to the AstarPath object in the scene. | |
| bool | open | Is the graph open in the editor. | |
| bool | infoScreenOpen | Used in the editor to check if the info screen is open. | |
| Node[] | nodes | All nodes this graph contains. | |
| Matrix4x4 | matrix | A matrix for translating/rotating/scaling the graph. |
| System.Guid | guid [get, set] |
Used as an ID of the graph, considered to be unique. |
Base class for all graphs.
| virtual void Awake | ( | ) | [virtual] |
This will be called on the same time as Awake on the gameObject which the AstarPath script is attached to.
(remember, not in the editor) Use this for any initialization code which can't be placed in Scan
| virtual Node [] CreateNodes | ( | int | number | ) | [virtual] |
Creates a number of nodes with the correct type for the graph.
Called by graph generators and when deserializing a graph with nodes. Override this function if you do not use the default Node class.
| number | A System.Int32 |
| NNInfo GetNearest | ( | Vector3 | position | ) |
Returns the nerest node to a position using the default constraint.
| position | A Vector3 |
| virtual NNInfo GetNearest | ( | Vector3 | position, |
| NNConstraint | constraint, | ||
| Node | hint = null |
||
| ) | [virtual] |
Returns the nearest node to a position using the specified NNConstraint.
| position | The position to try to find a close node to |
| hint | Can be passed to enable some graph generators to find the nearest node faster. |
| constraint | Can for example tell the function to try to return a walkable node. If you do not get a good node back, consider calling GetNearestForce. |
Reimplemented in GridGraph, NavMeshGraph, and RecastGraph.
| virtual NNInfo GetNearestForce | ( | Vector3 | position, |
| NNConstraint | constraint | ||
| ) | [virtual] |
Returns the nearest node to a position using the specified constraint.
| position | A Vector3 |
| constraint | A NNConstraint |
Reimplemented in GridGraph, NavMeshGraph, and RecastGraph.
Returns a color to be used for the specified node with the current debug settings (editor only)
| node | A Node |
| virtual void OnDestroy | ( | ) | [virtual] |
Function for cleaning up references.
This will be called on the same time as OnDisable on the gameObject which the AstarPath script is attached to (remember, not in the editor) Use for any cleanup code such as cleaning up static variables which otherwise might prevent resources from being collected Use by creating a function overriding this one in a graph class, but always call base.OnDestroy () in that function.
Reimplemented in GridGraph.
| virtual void RelocateNodes | ( | Matrix4x4 | oldMatrix, |
| Matrix4x4 | newMatrix | ||
| ) | [virtual] |
Relocates the nodes in this graph.
Assumes the nodes are translated using the "oldMatrix", then translates them according to the "newMatrix". The "oldMatrix" is not required by all implementations of this function though (e.g the NavMesh generator).
| oldMatrix | A Matrix4x4 |
| newMatrix | A Matrix4x4 |
Reimplemented in NavMeshGraph.
| void SafeOnDestroy | ( | ) |
SafeOnDestroy should be used when there is a risk that the pathfinding is searching through this graph when called.
| virtual void Scan | ( | ) | [virtual] |
Scanns the graph, called from AstarPath.Scan Override this function to implement custom scanning logic.
Reimplemented in NavMeshGraph, RecastGraph, GridGraph, ListGraph, PolarGraph, and SimpleGraph.
| void ScanGraph | ( | ) |
Scanns the graph with appropriate pre and post processing calls.
Consider using AstarPath.Scan () instead since this function might screw things up if there is more than one graph. This function does not call AstarPath.FloodFill
| System.Guid _guid = System.Guid.NewGuid () |
See NavGraph.guid.
This variable is not used.
| byte [] _sguid |
See NavGraph.guid used to store the guid value.
See NavGraph.guid, used to store the guid value
Reference to the AstarPath object in the scene.
Might not be entirely safe to use, it's better to use AstarPath.active
| bool infoScreenOpen |
Used in the editor to check if the info screen is open.
Should be inside UNITY_EDITOR only #ifs but just in case anyone tries to serialize a NavGraph instance using Unity, I have left it like this as it would otherwise cause a crash when building. Version 3.0.8.1 was released because of this bug only
| Matrix4x4 matrix |
A matrix for translating/rotating/scaling the graph.
Not all graph generators supports this though.
All nodes this graph contains.
This can be iterated to search for a specific node. This should be set if the graph does contain any nodes
| bool open |
Is the graph open in the editor.
System.Guid guid [get, set] |
Used as an ID of the graph, considered to be unique.