|
A* Pathfinding Project
3.0.9
The A* Pathfinding Project for Unity
|
Finds all nodes within a specified distance from the start. More...
Inheritance diagram for ConstantPath:
Collaboration diagram for ConstantPath:| ConstantPath (Vector3 start, OnPathDelegate callbackDelegate) | Creates a new ConstantPath starting from the specified point. | ||
| ConstantPath (Vector3 start, int maxGScore, OnPathDelegate callbackDelegate) | Creates a new ConstantPath starting from the specified point. | ||
| override void | Reset (Vector3 start, Vector3 end, OnPathDelegate callbackDelegate, bool reset) | Reset the path to default values. | |
| override void | Initialize () | Initializes the path. | |
| override float | CalculateStep (float remainingFrameTime) | Calculates the path until completed or until the function duration has exceeded remainingFrameTime. |
| List< Node > | allNodes = new List<Node>() | Contains all nodes the path found. | |
| PathEndingCondition | endingCondition | Controls when the path should terminate. |
Finds all nodes within a specified distance from the start.
This class will search outwards from the start point and find all nodes which it costs less than ConstantPath::maxGScore to reach, this is usually the same as the distance to them multiplied with 100
The path can be called like:
//Here you create a new path and set how far it should search. Null is for the callback, but the seeker will handle that ConstantPath cpath = new ConstantPath(transform.position,2000,null); //Set the seeker to search for the path (where mySeeker is a variable referencing a Seeker component) mySeeker.StartPath (cpath,myCallbackFunction);
Then when getting the callback, all nodes will be stored in the variable ConstantPath::allNodes (remember that you need to cast it from Path to ConstantPath first to get the variable).
This list will be sorted by G score (cost/distance to reach the node), however only the last duplicate of a node in the list is guaranteed to be sorted in this way.
| ConstantPath | ( | Vector3 | start, |
| OnPathDelegate | callbackDelegate | ||
| ) |
Creates a new ConstantPath starting from the specified point.
| start | From where the path will be started from (the closest node to that point will be used) |
| callbackDelegate | Will be called when the path has completed, leave this to null if you use a Seeker to handle calls Searching will be stopped when a node has a G score (cost to reach it) higher than what's specified as default value in Pathfinding::EndingConditionDistance |
| ConstantPath | ( | Vector3 | start, |
| int | maxGScore, | ||
| OnPathDelegate | callbackDelegate | ||
| ) |
Creates a new ConstantPath starting from the specified point.
| start | From where the path will be started from (the closest node to that point will be used) |
| maxGScore | Searching will be stopped when a node has a G score greater than this |
| callbackDelegate | Will be called when the path has completed, leave this to null if you use a Seeker to handle calls |
Searching will be stopped when a node has a G score (cost to reach it) greater than maxGScore
| override float CalculateStep | ( | float | remainingFrameTime | ) | [virtual] |
Calculates the path until completed or until the function duration has exceeded remainingFrameTime.
Usually a check is only done every 500 nodes if the time has exceeded remainingFrameTime.
Reimplemented from Path.
| override void Initialize | ( | ) | [virtual] |
| override void Reset | ( | Vector3 | start, |
| Vector3 | end, | ||
| OnPathDelegate | callbackDelegate, | ||
| bool | reset | ||
| ) | [virtual] |
Reset the path to default values.
Clears the allNodes list.
Also sets heuristic to Heuristic.None as it is the default value for this path type
Reimplemented from Path.
Contains all nodes the path found.
Controls when the path should terminate.
This is set up automatically in the constructor to an instance of the Pathfinding::EndingConditionDistance class with a maxGScore is specified in the constructor. If you want to use another ending condition.