public void AddLayer(MapLayer layer) { if (layer.Width != _mapWidth && layer.Height != _mapHeight) throw new Exception("Map layer size exception"); _mapLayers.Add(layer); }
public static MapLayer FromMapLayerData(MapLayerData data) { var layer = new MapLayer(data.Width, data.Height); for (int y = 0; y < data.Height; y++) for (int x = 0; x < data.Width; x++) { //Console.WriteLine("({0}, {1}): {2}, {3}", x, y, data.GetTile(x, y).TileIndex, data.GetTile(x, y).TileSetIndex); layer.SetTile(x, y, data.GetTile(x, y).TileIndex, data.GetTile(x, y).TilesetIndex); } return layer; }
public TileMap(Tileset tileset, MapLayer layer) : this(new List<Tileset> { tileset }, new List<MapLayer> { layer }) { }