private void ConnectHexes() { foreach (var hexagon in Hexes) { foreach (HexDirection dir in Enum.GetValues(typeof(HexDirection))) { hexagon.Neighbors[dir] = GetHex(HexMetrics.GetNeighborCoords(hexagon.MapPos, dir)); } } }
public void GetMatchingPoints(int x, int y, HexDirection dir, HexagonPoint[] expected) { var hex = new Hexagon(new Point(x, y)); var offset = HexMetrics.GetNeighborCoords(new Point(x, y), dir); var neighbor = new Hexagon(offset); var ret = hex.GetMatchingPoints(neighbor); Assert.True(ret.Count == expected.Length, $"expected has {expected.Length} actual has {ret.Count}"); foreach (var hexagonPoint in expected) { Assert.True(ret.Contains(hexagonPoint), hexagonPoint + " is missing!"); } }
public void GetNeighborCoords(int hx, int hy, HexDirection d, int ex, int ey) { Assert.AreEqual(new Point(ex, ey), HexMetrics.GetNeighborCoords(new Point(hx, hy), d)); }