Graph Nodes Property Delta Engine Documentation

Namespace: DeltaEngine.GameLogic.PathFinding
Assembly: DeltaEngine.GameLogic.PathFinding (in DeltaEngine.GameLogic.PathFinding.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public GraphNode[] Nodes { get; }

Property Value

Type:  GraphNode 
Remarks

Tests: DeltaEngine.GameLogic.PathFinding.Tests.GraphTests
Remarks

Tests: DeltaEngine.GameLogic.PathFinding.Tests.LevelGraphTests
Examples

3 unit tests call DeltaEngine.GameLogic.PathFinding.Graph.Nodes
[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));
}
[Test]
public void CheckForNotConnectedNodes()
{
    Assert.IsFalse(graphAsPlusShape.IsConnected(1, 0));
    Assert.IsFalse(graphAsPlusShape.IsConnected(0, 1));
    Assert.IsFalse(graphAsPlusShape.IsConnected(3, 0));
    Assert.IsFalse(graphAsPlusShape.IsConnected(0, 3));
    Assert.IsFalse(graphAsPlusShape.IsConnected(3, 4));
    Assert.IsFalse(graphAsPlusShape.IsConnected(4, 3));
    Assert.IsFalse(graphAsPlusShape.IsConnected(1, 4));
    Assert.IsFalse(graphAsPlusShape.IsConnected(4, 1));
    Assert.IsFalse(graphAsPlusShape.IsConnected(0, 4));
    Assert.IsFalse(graphAsPlusShape.IsConnected(4, 0));
    Assert.IsFalse(graphAsPlusShape.IsConnected(1, 3));
    Assert.IsFalse(graphAsPlusShape.IsConnected(3, 1));
    Assert.IsFalse(graphAsPlusShape.IsConnected(2, 2));
}
Examples

3 unit tests call DeltaEngine.GameLogic.PathFinding.Graph.Nodes
[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));
}
[Test]
public void CheckGetNodes()
{
    Assert.AreEqual(4, grid3X2.GetNode(1, 1).Id);
}
See Also