Algorithm for the graph path finding
View code on GitHub
Inheritance Hierarchy
DeltaEngine.GameLogic.PathFinding GraphSearch
DeltaEngine.GameLogic.PathFinding AStarSearch
Namespace: DeltaEngine.GameLogic.PathFinding
Assembly: DeltaEngine.GameLogic.PathFinding (in DeltaEngine.GameLogic.PathFinding.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The AStarSearch type exposes the following members.
Constructors
Name | Description | |
---|---|---|
AStarSearch | Initializes a new instance of the AStarSearch class |
Methods
Name | Description | |
---|---|---|
GetNextNode | (Inherited from GraphSearch.) | |
GetPath | (Inherited from GraphSearch.) | |
Initialize | (Inherited from GraphSearch.) | |
Search | (Overrides GraphSearch Search(Graph, Int32, Int32).) |
Fields
Name | Description | |
---|---|---|
costSoFar | (Inherited from GraphSearch.) | |
graph | (Inherited from GraphSearch.) | |
nodesToCheck | (Inherited from GraphSearch.) | |
previousNode | (Inherited from GraphSearch.) | |
startNode | (Inherited from GraphSearch.) | |
targetNode | (Inherited from GraphSearch.) | |
visitedNodes | (Inherited from GraphSearch.) |
Remarks
Examples
[Test] public void SearchForPathBetweenNodes() { Assert.IsTrue(aStar.Search(graph, 0, 2)); Assert.IsTrue(aStar.Search(graph, 1, 5)); Assert.IsFalse(aStar.Search(graph, 5, 2)); }
[Test] public void GraphWithNoNodesHasNoPath() { Assert.IsFalse(aStar.Search(new Graph(0), 0, 0)); }
[Test] public void CheckPathList() { aStar.Search(graph, 0, 2); Assert.AreEqual(2, aStar.GetPath().GetListOfCoordinates().Count); aStar.Search(graph, 1, 5); Assert.AreEqual(3, aStar.GetPath().GetListOfCoordinates().Count); }
See Also