public void FillAreaWithTile(Point origin, int tilesWide, int tilesTall, MapTile tileTemplate) { Rectangle area = new Rectangle(origin.X, origin.Y, origin.X + tilesWide, origin.Y + tilesTall); for (int y = area.Y; y < area.Height; y++) { for (int x = area.X; x < area.Width; x++) { MapTileList mapTiles = GetMapTilesForLocation(x, y); MapTile tileToAdd = (MapTile)tileTemplate.Clone(); mapTiles.Add(tileToAdd); _mapTileLocations[tileToAdd] = new Point(x, y); } } }
public void SetBaseAreaWithTile(Point origin, int tilesWide, int tilesTall, MapTile tileTemplate) { Rectangle area = new Rectangle(origin.X, origin.Y, origin.X + tilesWide, origin.Y + tilesTall); for (int y = area.Y; y < area.Height; y++) { for (int x = area.X; x < area.Width; x++) { MapTileList mapTiles = GetMapTilesForLocation(x, y); MapTile tileToAdd = (MapTile)tileTemplate.Clone(); if (mapTiles.Count > 0) { _mapTileLocations.Remove(mapTiles[0]); mapTiles[0] = tileToAdd; } else { mapTiles.Add(tileToAdd); } _mapTileLocations[tileToAdd] = new Point(x, y); } } }