Пример #1
0
        public List <List <HexCoordinate> > GetRingsSurroundingHex(HexCoordinate coordinate, int maxRings)
        {
            // reference: http://gamedev.stackexchange.com/questions/51264/get-ring-of-tiles-in-hexagon-grid
            // int ring = 1
            //   Travel around the ring by traversing N,SE,S,SW,W,NW,N,NE multiplied by the ring number
            //   ring++
            //      Travel Around ring again
            //      cont until desired ring...

            var hexRings = new List <List <HexCoordinate> >();

            // Add in the current hex to the list
            var currentHex = new List <HexCoordinate>();

            currentHex.Add(coordinate);
            hexRings.Add(currentHex);

            // Now go through and add the other rings
            while (hexRings.Count <= maxRings)
            {
                hexRings.Add(coordinate.GetRingAroundHex(hexRings.Count));
            }

            return(hexRings);
        }