示例#1
0
        public MapRenderable2D(MapData2D mapData, ITexture tileset, TilesetData tileData) : base(Handlers)
        {
            _mapData  = mapData;
            _tileset  = tileset;
            _tileData = tileData;
            _tileset.GetSubImageDetails(0, out var tileSize, out _, out _, out _);
            TileSize = tileSize;

            var underlay = new SpriteInstanceData[_mapData.Width * _mapData.Height];
            var overlay  = new SpriteInstanceData[_mapData.Width * _mapData.Height];

            _underlay = new MultiSprite(new SpriteKey(
                                            _tileset,
                                            (int)DrawLayer.Underlay,
                                            underlay[0].Flags))
            {
                Instances = underlay.ToArray()
            };

            _overlay = new MultiSprite(new SpriteKey(
                                           _tileset,
                                           (int)DrawLayer.Overlay3,
                                           overlay[0].Flags))
            {
                Instances = overlay.ToArray()
            };
        }