Esempio n. 1
0
        public static bool AxisAligned(IList <Hex> hexes, Position direction)
        {
            if (null == hexes || hexes.Count < 2)
            {
                return(true);
            }
            Hex directionHex         = Neighborhood.GetDirectionHex(direction);
            Hex directionOppositeHex = Neighborhood.GetDirectionHex(Neighborhood.GetOpposite(direction));

            return(hexes.Skip(1).All(h =>
                                     AxisAligned(hexes[0], h) &&
                                     (DirectionHex(hexes[0], h) == directionHex || DirectionHex(hexes[0], h) == directionOppositeHex)
                                     ));
        }
Esempio n. 2
0
 public static void LinkCells(Cell from, Cell to, Position pos)
 {
     from.neighborhood[pos] = to;
     to.neighborhood[Neighborhood.GetOpposite(pos)] = from;
 }