Esempio n. 1
0
 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);
 }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
 public HexOffset(VectorTwo v)
 {
     x = v.X;
     y = v.Y;
 }
Esempio n. 4
0
 public static VectorTwo GetAdjacentHex(VectorTwo cell, int direction)
 {
     return(new HexOffset(cell).GetAdjacentHex(direction).ToVector());
 }
Esempio n. 5
0
 public static VectorTwo[] GetNeighbours(VectorTwo cell)
 {
     return(new HexOffset(cell).GetNeighbors().Select(c => c.ToVector()).ToArray());
 }