void DebugHexMath() { Vector3Int origin = new Vector3Int(0, 0, 0); Vector3Int target = new Vector3Int(2, 2, 0); Vector3Int targetCube = new Vector3Int(1, -3, 2); // Distance testing: Oddr then Cube Assert.AreEqual(HexMath.OddrDistance(origin, origin), 0); Assert.AreEqual(HexMath.OddrDistance(origin, origin + HexMath.CubeDirection(0)), 1); Assert.AreEqual(HexMath.OddrDistance(origin, origin + HexMath.CubeDirection(0) * 2), 2); Assert.AreEqual(HexMath.OddrDistance(origin, target), 3); Assert.AreEqual(HexMath.OddrDistance(origin, target + HexMath.CubeDirection(0)), 2); Assert.AreEqual(HexMath.OddrDistance(origin, new Vector3Int(-6, -6, 0)), 9); Assert.AreEqual(HexMath.CubeDistance(origin, origin), 0); Assert.AreEqual(HexMath.CubeDistance(origin, origin + HexMath.CubeDirection(0) * 2), 2); Assert.AreEqual(HexMath.CubeDistance(origin, new Vector3Int(0, 0, 0)), 0); Assert.AreEqual(HexMath.CubeDistance(origin, targetCube), 3); Assert.AreEqual(HexMath.CubeDistance(origin, target + HexMath.CubeDirection(0)), 2); Assert.AreEqual(HexMath.CubeDistance(origin, new Vector3Int(-1, 4, -3)), 4); // Cube - Hex conversion testing. Vector3Int Hex = new Vector3Int(1, 1, 0); Vector3Int Cube = new Vector3Int(1, -2, 1); Assert.AreEqual(Hex, HexMath.CubeToOddr(Cube)); Assert.AreEqual(Cube, HexMath.OddrToCube(Hex)); Hex = new Vector3Int(-2, -2, 0); Cube = new Vector3Int(-1, 3, -2); Assert.AreEqual(Hex, HexMath.CubeToOddr(Cube)); Assert.AreEqual(Cube, HexMath.OddrToCube(Hex)); Hex = new Vector3Int(1, -2, 0); Cube = new Vector3Int(2, 0, -2); Assert.AreEqual(Hex, HexMath.CubeToOddr(Cube)); Assert.AreEqual(Cube, HexMath.OddrToCube(Hex)); Hex = new Vector3Int(-2, 2, 0); Cube = new Vector3Int(-3, 1, 2); Assert.AreEqual(Hex, HexMath.CubeToOddr(Cube)); Assert.AreEqual(Cube, HexMath.OddrToCube(Hex)); /* Neighbor Testing: Testing around Origin: (0, 0, 0). * - Radius 0. It's a marsh, so a neighbor test of radius 0 should simply return one marsh. * - Radius 1. Should add 6 soil tiles and count equal 7 * - Radius 2. Should add 12 barren tiles and count equal 19. * No tiles should be water for this setup. */ NeighborTestHelper(0); NeighborTestHelper(1); NeighborTestHelper(2); NeighborTestHelper(3); }