Basis for path finding with A-Star, usually used via LevelGraph for 2D maps.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.GameLogic.PathFinding Graph
DeltaEngine.GameLogic.PathFinding LevelGraph
Namespace: DeltaEngine.GameLogic.PathFinding
Assembly: DeltaEngine.GameLogic.PathFinding (in DeltaEngine.GameLogic.PathFinding.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The Graph type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Graph | Initializes a new instance of the Graph class |
Methods
Name | Description | |
---|---|---|
Connect | ||
GetNode | ||
IsConnected | ||
IsInvalidNodeId |
Properties
Name | Description | |
---|---|---|
AdjacentLinks | ||
Nodes | ||
NumberOfNodes |
Remarks
Examples
[Test] public void ThrowExceptionISearchedForWrongNode() { Assert.Throws<Graph.InvalidNodeId>(() => graphAsPlusShape.GetNode(-1)); }
[Test] public void CheckForExistingGraphNodes() { for (int nodeId = 0; nodeId < NumberOfNodesInGraph; nodeId++) Assert.IsNotNull(graphAsPlusShape.GetNode(nodeId)); }
[Test] public void CheckForConnectedNodes() { Assert.IsTrue(graphAsPlusShape.IsConnected(2, 0)); Assert.IsTrue(graphAsPlusShape.IsConnected(0, 2)); Assert.IsTrue(graphAsPlusShape.IsConnected(2, 1)); Assert.IsTrue(graphAsPlusShape.IsConnected(1, 2)); Assert.IsTrue(graphAsPlusShape.IsConnected(2, 3)); Assert.IsTrue(graphAsPlusShape.IsConnected(3, 2)); Assert.IsTrue(graphAsPlusShape.IsConnected(2, 4)); Assert.IsTrue(graphAsPlusShape.IsConnected(4, 2)); }
See Also