2D path finding graph for levels using columns (x) and rows (y) for indexing.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.GameLogic.PathFinding Graph
DeltaEngine.GameLogic.PathFinding LevelGraph
DeltaEngine.GameLogic.PathFinding.Tests LevelGraphTests MockLevelGraph
Namespace: DeltaEngine.GameLogic.PathFinding
Assembly: DeltaEngine.GameLogic.PathFinding (in DeltaEngine.GameLogic.PathFinding.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The LevelGraph type exposes the following members.
Constructors
Name | Description | |
---|---|---|
LevelGraph | Initializes a new instance of the LevelGraph class |
Methods
Name | Description | |
---|---|---|
Connect | (Overrides Graph Connect(Int32, Int32, Int32, Boolean).) | |
ConnectAllNodesToLinkGrid | ||
GetClosestNode | ||
GetNode(Int32) | (Inherited from Graph.) | |
GetNode(Int32, Int32) | ||
IsConnected | (Inherited from Graph.) | |
IsInvalidNodeId | (Inherited from Graph.) | |
IsUnreachableNode | ||
ResetGraph | ||
SetReachableAndUpdate | ||
SetUnreachableAndUpdate | ||
SetUnreachableNode | ||
UpdateWeightInAdjacentNodes |
Fields
Name | Description | |
---|---|---|
AreDiagonalPathAllowed |
Properties
Name | Description | |
---|---|---|
AdjacentLinks | (Inherited from Graph.) | |
Nodes | (Inherited from Graph.) | |
NumberOfNodes | (Inherited from Graph.) |
Remarks
Examples
[Test] public void CheckNodePositions() { Assert.AreEqual(new Vector2D(0, 0), grid3X2.GetNode(0).Position); Assert.AreEqual(new Vector2D(1, 0), grid3X2.GetNode(1).Position); Assert.AreEqual(new Vector2D(2, 0), grid3X2.GetNode(2).Position); Assert.AreEqual(new Vector2D(0, 1), grid3X2.GetNode(3).Position); Assert.AreEqual(new Vector2D(1, 1), grid3X2.GetNode(4).Position); Assert.AreEqual(new Vector2D(2, 1), grid3X2.GetNode(5).Position); }
[Test] public void CheckForConnectedNodes() { Assert.IsTrue(grid3X2.IsConnected(0, 1)); Assert.IsTrue(grid3X2.IsConnected(1, 0)); Assert.IsTrue(grid3X2.IsConnected(1, 4)); Assert.IsTrue(grid3X2.IsConnected(2, 1)); Assert.IsTrue(grid3X2.IsConnected(2, 5)); Assert.IsTrue(grid3X2.IsConnected(3, 4)); Assert.IsTrue(grid3X2.IsConnected(4, 5)); }
[Test] public void CheckForNotConnectedNodes() { Assert.IsFalse(grid3X2.IsConnected(0, 4)); Assert.IsFalse(grid3X2.IsConnected(4, 0)); Assert.IsFalse(grid3X2.IsConnected(1, 3)); Assert.IsFalse(grid3X2.IsConnected(3, 1)); Assert.IsFalse(grid3X2.IsConnected(1, 5)); Assert.IsFalse(grid3X2.IsConnected(5, 1)); Assert.IsFalse(grid3X2.IsConnected(2, 4)); Assert.IsFalse(grid3X2.IsConnected(4, 2)); Assert.IsFalse(grid3X2.IsConnected(0, 5)); Assert.IsFalse(grid3X2.IsConnected(5, 0)); Assert.IsFalse(grid3X2.IsConnected(2, 3)); Assert.IsFalse(grid3X2.IsConnected(3, 2)); }
See Also