public bool Load_Map(string id, float x = -1, float y = -1)
        {
            if (!can_change)
            {
                return(false);
            }
            can_change = false;

            DestroyAllButPersistant();

            Map = new Tiled_Map(id, camera, world, this, particle_world, lua, device, lighting, true)
            {
                Change_Scene_Callback = Load_Map
            };

            // TODO(Ayran): Need to find a less shitty way of doing this...
            ((Animation_Renderer_System)world.Get_System <Animation_Renderer_System>())?.Give_Tile_Map(Map);
            ((Sprite_Renderer_System)world.Get_System <Sprite_Renderer_System>())?.Give_Tile_Map(Map);
            ((Advanced_Animation_Rendering_System)world.Get_System <Advanced_Animation_Rendering_System>())?.Give_Tile_Map(Map);
            ((Multipart_Animation_System)world.Get_System <Multipart_Animation_System>())?.Give_Tile_Map(Map);

            if (x != -1 && y != -1)
            {
                var list = world.Get_All_With_Component(Component.Types.Player);
                if (list.Count > 0)
                {
                    var player = list.Last();
                    if (player != null)
                    {
                        var body    = (Body)player.Get(Component.Types.Body);
                        var physics = (Physics)player.Get(Component.Types.Physics);

                        body.X = x;
                        body.Y = y;

                        physics.Velocity = Vector2.Zero;
                    }
                }
            }

            return(true);
        }
 public void Give_Tile_Map(Tiled_Map _tilemap)
 {
     this.tile_map_reference = _tilemap;
 }
Пример #3
0
 public void Give_Map(Tiled_Map map) => this.tiled_map = map;