Exemplo n.º 1
0
        public Pause(NeonArkanoidGame game, Level.Level level)
        {
            _level = level;
            _game = game;

            x = -500;

            var background = new Sprite(UtilStrings.SpritesPause + "background_pause.png");
            background.SetOrigin(0, background.height/2);
            background.y = game.height/2;

            var header = new Sprite(UtilStrings.SpritesPause + "header_pause.png");
            header.SetOrigin(header.width/2, header.height/2);
            header.SetXY(background.width/2, 200);

            _buttons = new[]
            {
                new Button(UtilStrings.SpritesPause + "button_resume.png", 2, background.width/2, 350, "Resume"),
                new Button(UtilStrings.SpritesPause + "button_restart.png", 2, background.width/2, 450,
                    _level.GetLevelName()),
                new Button(UtilStrings.SpritesPause + "button_exit.png", 2, background.width/2, 550, "MainMenu")
            };

            AddChild(background);
            AddChild(header);
            foreach (var button in _buttons)
            {
                AddChild(button);
            }

            _selectedSound = new Sound(UtilStrings.SoundsMenu + "sound_selected.wav");
            _openSound = new Sound(UtilStrings.SoundsMenu + "sound_pause.wav");
        }
        private void StartState()
        {
            switch (_state)
            {
            case "MainMenu":
                _menu = new MainMenu(this);
                AddChild(_menu);
                break;

            case "Level1":
                _level = new Level.Level("tiger 4.tmx", this);
                AddChild(_level);
                break;

            case "Level2":
                _level = new Level.Level("rocket.tmx", this);
                AddChild(_level);
                break;

            case "Credits":
                _credits = new Credits(this);
                AddChild(_credits);
                break;

            case "Exit":
                Environment.Exit(0);
                break;

            default:
                throw new Exception("You tried to load a non-existant state");
            }
        }
        private void StopState()
        {
            switch (_state)
            {
            case "MainMenu":
                _menu.StopMusic();
                _menu.Destroy();
                _menu = null;
                break;

            case "Level1":
                _level.Destroy();
                _level = null;
                break;

            case "Level2":
                _level.Destroy();
                _level = null;
                break;

            case "Credits":
                _credits.Destroy();
                _credits = null;
                break;
            }
        }
 private void StartState()
 {
     switch (_state)
     {
         case "MainMenu":
             _menu = new MainMenu(this);
             AddChild(_menu);
             break;
         case "Level1":
             _level = new Level.Level("tiger 4.tmx", this);
             AddChild(_level);
             break;
         case "Level2":
             _level = new Level.Level("rocket.tmx", this);
             AddChild(_level);
             break;
         case "Credits":
             _credits = new Credits(this);
             AddChild(_credits);
             break;
         case "Exit":
             Environment.Exit(0);
             break;
         default:
             throw new Exception("You tried to load a non-existant state");
     }
 }
        private void StopState()
        {
            switch (_state)
            {
                case "MainMenu":
                    _menu.StopMusic();
                    _menu.Destroy();
                    _menu = null;
                    break;
                case "Level1":
                    _level.Destroy();
                    _level = null;
                    break;
                case "Level2":
                    _level.Destroy();
                    _level = null;
                    break;
                case "Credits":
                    _credits.Destroy();
                    _credits = null;
                    break;

            }
        }