Class AStar
Interface to setup and run the A* algorithm.
Inheritance
Inherited Members
Namespace: Fibula.Common.Utilities.Pathfinding
Assembly: Fibula.Common.Utilities.dll
Syntax
public class AStar
Constructors
| Improve this Doc View SourceAStar(INodeFactory, INode, INode, Int32)
Initializes a new instance of the AStar class.
Declaration
public AStar(INodeFactory nodeFactory, INode start, INode goal, int maxSearchSteps = 100)
Parameters
Type | Name | Description |
---|---|---|
INodeFactory | nodeFactory | A reference to the node factory in use. |
INode | start | The starting node for the AStar algorithm. |
INode | goal | The goal node for the AStar algorithm. |
System.Int32 | maxSearchSteps | Optional. The maximum number of Step operations to perform on the search. |
Properties
| Improve this Doc View SourceCurrentNode
Gets the current node that the AStar algorithm is at.
Declaration
public INode CurrentNode { get; }
Property Value
Type | Description |
---|---|
INode |
Methods
| Improve this Doc View SourceGetLastPath()
Gets the path of the last solution of the AStar algorithm. Will return a partial path if the algorithm has not finished yet.
Declaration
public IEnumerable<INode> GetLastPath()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<INode> | Returns null if the algorithm has never been run. |
Run()
Steps the AStar algorithm forward until it either fails or finds the goal node.
Declaration
public SearchState Run()
Returns
Type | Description |
---|---|
SearchState | Returns the state the algorithm finished in, Failed or GoalFound. |
Step()
Moves the AStar algorithm forward one step.
Declaration
public SearchState Step()
Returns
Type | Description |
---|---|
SearchState | Returns the state the alorithm is in after the step, either Failed, GoalFound or still Searching. |