23 lines
733 B
C#
23 lines
733 B
C#
|
using Godot;
|
||
|
using GoDotTest;
|
||
|
using System.Diagnostics;
|
||
|
|
||
|
public class HexGridTests : TestClass
|
||
|
{
|
||
|
public HexGridTests(Node testScene) : base(testScene)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void TestGetAt()
|
||
|
{
|
||
|
HexGrid grid = new HexGrid();
|
||
|
float w = grid.HexSize.x;
|
||
|
float h = grid.HexSize.y;
|
||
|
|
||
|
Debug.Assert(grid.GetHexAt(new Vector2(0, 0)).AxialCoords == new Vector2(0, 0));
|
||
|
Debug.Assert(grid.GetHexAt(new Vector2(w / 2 - 0.01f, 0)).AxialCoords == new Vector2(0, 0));
|
||
|
Debug.Assert(grid.GetHexAt(new Vector2(w / 2 - 0.01f, -h/2)).AxialCoords == new Vector2(1, 0));
|
||
|
Debug.Assert(grid.GetHexAt(new Vector2(w / 2 - 0.01f, h/2)).AxialCoords == new Vector2(1, -1));
|
||
|
}
|
||
|
}
|