public static VectorTwo[] GetControlZone(VectorTwo cell, int orientation) { VectorTwo[] cells = new VectorTwo[3]; for (int i = -1; i < 2; i++) { int direction = (orientation + i + 6) % 6; cells[i + 1] = GetAdjacentHex(cell, direction); } return(cells); }
public HexOffset GetAdjacentHex(int direction) { direction %= 6; while (direction < 0) { direction += 6; } VectorTwo[] steps = (y & 1) == 1 ? OddSteps : EvenSteps; VectorTwo step = steps[direction % 6]; return(new HexOffset(x + step.X, y + step.Y)); }
public HexOffset(VectorTwo v) { x = v.X; y = v.Y; }
public static VectorTwo GetAdjacentHex(VectorTwo cell, int direction) { return(new HexOffset(cell).GetAdjacentHex(direction).ToVector()); }
public static VectorTwo[] GetNeighbours(VectorTwo cell) { return(new HexOffset(cell).GetNeighbors().Select(c => c.ToVector()).ToArray()); }