TilesAt() public abstract method

public abstract TilesAt ( Rectangle region ) : IEnumerable
region Treefrog.Framework.Imaging.Rectangle
return IEnumerable
示例#1
0
        private Tile InnerApply(TileGridLayer tileLayer, int x, int y)
        {
            TileCoord[] coordSet  = NeighborCoordSet(x, y);
            List <int>  neighbors = new List <int>();

            for (int i = 0; i < coordSet.Length; i++)
            {
                if (ContainsMemberTile(tileLayer.TilesAt(coordSet[i])))
                {
                    neighbors.Add(i + 1);
                }
            }

            List <LocatedTile> targetStack = new List <LocatedTile>();

            foreach (LocatedTile tile in tileLayer.TilesAt(new TileCoord(x, y)))
            {
                targetStack.Add(tile);
            }

            foreach (LocatedTile tile in targetStack)
            {
                if (IsMemberTile(tile))
                {
                    tileLayer.RemoveTile(x, y, tile.Tile);
                }
            }

            int  index   = _brushClass.ApplyRules(neighbors);
            Tile newTile = null;

            if (index >= 0 && index < _tiles.Count && _tiles[index].Tile != null)
            {
                newTile = _tiles[index].Tile;
            }

            if (newTile != null)
            {
                tileLayer.AddTile(x, y, newTile);
            }

            return(newTile);
        }
示例#2
0
        public override void ApplyBrush(TileGridLayer tileLayer, int x, int y)
        {
            List <LocatedTile> updatedTiles = new List <LocatedTile>();

            updatedTiles.Add(new LocatedTile(InnerApply(tileLayer, x, y), x, y));

            // Update valid neighboring tiles
            foreach (TileCoord coord in NeighborCoordSet(x, y))
            {
                if (ContainsMemberTile(tileLayer.TilesAt(coord)))
                {
                    updatedTiles.Add(new LocatedTile(InnerApply(tileLayer, coord.X, coord.Y), coord.X, coord.Y));
                }
            }
        }
示例#3
0
        private Tile InnerApply(TileGridLayer tileLayer, int x, int y)
        {
            TileCoord[] coordSet = NeighborCoordSet(x, y);
            List<int> neighbors = new List<int>();

            for (int i = 0; i < coordSet.Length; i++) {
                if (ContainsMemberTile(tileLayer.TilesAt(coordSet[i])))
                    neighbors.Add(i + 1);
            }

            List<LocatedTile> targetStack = new List<LocatedTile>();
            foreach (LocatedTile tile in tileLayer.TilesAt(new TileCoord(x, y)))
                targetStack.Add(tile);

            foreach (LocatedTile tile in targetStack) {
                if (IsMemberTile(tile))
                    tileLayer.RemoveTile(x, y, tile.Tile);
            }

            int index = _brushClass.ApplyRules(neighbors);
            Tile newTile = null;

            if (index >= 0 && index < _tiles.Count && _tiles[index].Tile != null)
                newTile = _tiles[index].Tile;

            if (newTile != null)
                tileLayer.AddTile(x, y, newTile);

            return newTile;
        }
示例#4
0
        public override void ApplyBrush(TileGridLayer tileLayer, int x, int y)
        {
            List<LocatedTile> updatedTiles = new List<LocatedTile>();

            updatedTiles.Add(new LocatedTile(InnerApply(tileLayer, x, y), x, y));

            // Update valid neighboring tiles
            foreach (TileCoord coord in NeighborCoordSet(x, y)) {
                if (ContainsMemberTile(tileLayer.TilesAt(coord)))
                    updatedTiles.Add(new LocatedTile(InnerApply(tileLayer, coord.X, coord.Y), coord.X, coord.Y));
            }
        }