Example #1
0
        public void AddLayer(MapLayer layer)
        {
            if (layer.Width != _mapWidth && layer.Height != _mapHeight)
                throw new Exception("Map layer size exception");

            _mapLayers.Add(layer);
        }
Example #2
0
        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;
        }
Example #3
0
 public TileMap(Tileset tileset, MapLayer layer)
     : this(new List<Tileset> { tileset }, new List<MapLayer> { layer })
 {
 }