Example #1
0
        public ITile GetTile(TileCoord tileCoord)
        {
            TileGrid grid = grids[tileCoord.Alt];
            if (grid != null)
                return grid[tileCoord.Row, tileCoord.Col];

            return null;
        }
Example #2
0
        public Tuple<ITile, TileCoord>[] GetUnblockedNeighboors(TileCoord coord)
        {
            Tuple<ITile, TileCoord>[] neighbors = new Tuple<ITile, TileCoord>[8];
            TileGrid grid = grids[coord.Alt];

            if (grid == null)
                return neighbors;

            int neighCount = 0;
            for (int i = coord.Row - 1; i < coord.Row + 2; i++)
            {
                for (int j = 0; j < coord.Col + 2; j++)
                {
                    if (!(i == coord.Row && j == coord.Col))
                    {
                        neighbors[neighCount++] = new Tuple<ITile, TileCoord>(grid[i, j], new TileCoord(i, j, coord.Alt));
                    }
                }
            }

            return neighbors;
        }
Example #3
0
 public TileRegion(TileCoord start, TileCoord end)
 {
     this.start = start;
     this.end = end;
 }
Example #4
0
        private static void Add(TileCoord point, int [] ns, int [] ne)
        {
            for (int k = 0; k < 3; k++)
            {
                if (point[k] < ns[k])
                    ns[k] = point[k];

                if (point[k] > ne[k])
                    ne[k] = point[k];
            }
        }