2022-12-02 21:09:40 +01:00
|
|
|
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;
|
2022-12-28 16:22:53 +01:00
|
|
|
|
2022-12-02 21:09:40 +01:00
|
|
|
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));
|
2022-12-28 16:22:53 +01:00
|
|
|
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));
|
2022-12-02 21:09:40 +01:00
|
|
|
}
|
|
|
|
}
|