Exemplo n.º 1
0
        public static void NextLevel()
        {
            if (currentLevel == 1)
            {
                currentLevel = 2;
                //create mario/player
                for (int i = 0; i < controllers.Count; i++)
                {
                    controllers[i].FullClear();
                }
                //mario.RaiseCollisionEvent += player.HandleMarioCollision;
                //mario.RaiseInstantDeathEvent += player.HandleInstantDeathEvent;
                KeyboardController keyboard = new KeyboardController();
                GamepadController gamepad = new GamepadController();

                Loader.LoadLevel(camera, "LevelLoader/World1-2.txt");
                level.SetUpLevel();
                level.RaiseLevelEvent += mario.HandleLevelEvent;
                level.State = new Playing(level);
                level.State.Enter();
                camera.Limits = level.GetTree().Bounds;
            }
            else
            {
                FullReset();
            }
        }
Exemplo n.º 2
0
        public static void InitializeLevel(Game1 game)
        {
            currentLevel = 1;
            sound = SoundFactory.Instance.FirstLevel();
            //create mario/player
            player = new Player
            {
                PlayerMario = new Mario(game.Content.Load<Texture2D>("mario/mario_sprites"))
            };
            mario = player.PlayerMario;
            mario.RaiseCollisionEvent += player.HandleMarioCollision;
            mario.RaiseInstantDeathEvent += player.HandleInstantDeathEvent;
            KeyboardController keyboard = new KeyboardController();
            GamepadController gamepad = new GamepadController();
            Loader.LoadLevel(game.GameCamera, "LevelLoader/World1-1.txt");

            controllers = new List<IController>
            {
                keyboard,
                gamepad
            };

            theGame = game;
            camera = game.GameCamera;
            level.SetUpLevel();
            Rectangle limits = level.GetTree().Bounds;
            limits.Height -= 16;
            camera.Limits = limits;
            level.RaiseLevelEvent += mario.HandleLevelEvent;
            level.State = new Playing(level);
            level.State.Enter();
        }
Exemplo n.º 3
0
        public static void FullClear()
        {
            for(int i = 0; i < controllers.Count; i++)
            {
                controllers[i].FullClear();
            }

            sound = SoundFactory.Instance.FirstLevel();
            //create mario/player
            //mario.RaiseCollisionEvent += player.HandleMarioCollision;
               // mario.RaiseInstantDeathEvent += player.HandleInstantDeathEvent;
            KeyboardController keyboard = new KeyboardController();
            GamepadController gamepad = new GamepadController();
            Loader.LoadLevel(camera, "LevelLoader/World1-2.txt");
            level.SetUpLevel();
            level.RaiseLevelEvent += mario.HandleLevelEvent;
            level.State = new Playing(level);
            level.State.Enter();
        }