private void loadLevel(string newLevel)
        {
            disposeAll();

            GuiController.Instance.Modifiers.clear();
            GuiController.Instance.UserVars.clearVars();

            currentLevel = newLevel;

            XMLLevelParser levelParser = new XMLLevelParser(newLevel, CommandosUI.Instance.MediaDir);
            level = levelParser.getLevel();


            LevelMap map = level.Map;
            map.setMask(TextureLoader.FromFile(CommandosUI.Instance.d3dDevice, CommandosUI.Instance.MediaDir + "Mapa\\mask.jpg"));
            map.setFrame(TextureLoader.FromFile(CommandosUI.Instance.d3dDevice, CommandosUI.Instance.MediaDir + "Mapa\\frame.png"));
            map.Width = 2 * level.Map.Height;
            map.Height = 1.5f * level.Map.Height;
            map.Position = new Vector2(CommandosUI.Instance.ScreenWidth - level.Map.Width , 0);


            defaultRenderer = level.Renderer;
            shadowRenderer = new ShadowRenderer();

    
            //Movimiento por picking
            picking = new MovementPicking(level.Terrain);

            //Seleccion multiple
            selection = new Selection(level.Characters, level.Terrain);
             
            //Inicializar camara
            CommandosUI.Instance.Camera = new PCamera(new Vector3(0, 0, 150), level.Terrain);


            //Panel de control in game
            controlPanel = new GraphicalControlPanel(CommandosUI.Instance.MediaDir + "Sprites\\panel2.jpg");
            controlPanel.addCommand(new SwitchCrouch(selection.getSelectedCharacters()), CommandosUI.Instance.MediaDir + "Sprites\\crouch.png");
            controlPanel.addCommand(new StandBy(selection.getSelectedCharacters()), CommandosUI.Instance.MediaDir + "Sprites\\cancel.png");
            CommandosUI.Instance.Panel = controlPanel;

            foreach (Commando c in level.Commandos)
                controlPanel.addSelectionButton(c, selection);

            setAndBindModifiers();


        }
 private void disposeAll()
 {
     if(controlPanel!=null) controlPanel.dispose();
     if(level!=null)level.dispose();
     Modifiers.clear();
     level = null;
     controlPanel = null;
 }