Shared.MapData.OnCreated C# (CSharp) Method

OnCreated() public method

public OnCreated ( AsgardBase instance, Entity entity ) : void
instance AsgardBase
entity Entity
return void
        public override void OnCreated(AsgardBase instance, Entity entity)
        {
            var mapComponent = entity.GetComponent<MapComponent>();
            mapComponent.Map = new TiledMap(mapComponent.Device, Width, Height, TileWidth, TileHeight);
            mapComponent.Map.CreateTileset(mapComponent.Texture, FirstId, TileWidth, TileHeight, 1, 1);

            mapComponent.Map.CreateTileLayer("1", Layer1.Value.Width, Layer1.Value.Height, Layer1.Value.TileData);
            mapComponent.Map.CreateTileLayer("2", Layer2.Value.Width, Layer2.Value.Height, Layer2.Value.TileData);
            mapComponent.Map.CreateTileLayer("3", Layer3.Value.Width, Layer3.Value.Height, Layer3.Value.TileData);
            mapComponent.Map.CreateTileLayer("4", Layer4.Value.Width, Layer4.Value.Height, Layer4.Value.TileData);
            mapComponent.Map.CreateTileLayer("5", Layer5.Value.Width, Layer5.Value.Height, Layer5.Value.TileData);

            LoadCollisions(instance, mapComponent.Map);
        }