public void RestartLevel()
        {
            UnloadContent();
            //activeLevel = (LevelData)LevelList.ToArray()[currentLevel];
            activeLevel.startLevel(ScreenManager.Game);

            player.position = activeLevel.startingLocation;
            player.velocity = Vector3.Zero;
            player.netForce = Vector3.Zero;

            ScreenManager.Game.Components.Add(player);
            m_kCountdownTimer = new Utils.CountdownTimer(ScreenManager.Game, new Vector2(875.0f, 20.0f));
            m_kScoreKeeper = new Utils.ScoreKeeper(ScreenManager.Game, new Vector2(20f, 20f));
            m_kScoreKeeper.setScore(score);
            ScreenManager.Game.Components.Add(m_kCountdownTimer);
            ScreenManager.Game.Components.Add(m_kScoreKeeper);
            ScreenManager.Game.Components.Add(sky);
            manualCameraRotation = 0.0f;
        }
        public void SwitchToNextLevel()
        {
            currentLevel++;
            if (currentLevel > TOTAL_LEVELS) {
                currentLevel = 1;
            }
            //currentLevel = currentLevel % LevelList.Count;
            //activeLevel = (LevelData)LevelList.ToArray()[currentLevel];
            //activeLevel.startLevel(ScreenManager.Game);

            if (activeLevel != null)
            {

                activeLevel.clearLevel(ScreenManager.Game);
                activeLevel = null;
            }
            switch (currentLevel) {
                case 1:
                    activeLevel = new Level1(ScreenManager.Game, this);
                    break;
                case 2:
                    activeLevel = new Level2(ScreenManager.Game, this);
                    break;
                case 3:
                    activeLevel = new Level3(ScreenManager.Game, this);
                    break;
                case 4:
                    activeLevel = new Level4(ScreenManager.Game, this);
                    break;
                case 5:
                    activeLevel = new Level5(ScreenManager.Game, this);
                    break;
                default:
                    break;
            }
            activeLevel.startLevel(ScreenManager.Game);

            player.position = activeLevel.startingLocation;
            player.velocity = Vector3.Zero;
            player.netForce = Vector3.Zero;
            manualCameraRotation = 0.0f;
            ScreenManager.Game.Components.Add(player);
            m_kCountdownTimer = new Utils.CountdownTimer(ScreenManager.Game, new Vector2(875.0f, 20.0f));
            m_kScoreKeeper = new Utils.ScoreKeeper(ScreenManager.Game, new Vector2(20f, 20f));
            m_kScoreKeeper.setScore(score);
            ScreenManager.Game.Components.Add(m_kCountdownTimer);
            ScreenManager.Game.Components.Add(m_kScoreKeeper);
            ScreenManager.Game.Components.Add(sky);
        }
Example #3
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            base.LoadContent();

            m_kCountdownTimer = new Utils.CountdownTimer(ScreenManager.Game, new Vector2(500.0f, 50.0f));
            ScreenManager.Game.Components.Add(m_kCountdownTimer);

            player = new DragonBall(ScreenManager.Game, this);
            //player = new BallCharacter(ScreenManager.Game, this);
            player.position = new Vector3(0f, 0f, 0f);
            player.scale *= 3;
            ScreenManager.Game.Components.Add(player);

            m_kWallManager = new WallManager(ScreenManager.Game, this);
            ScreenManager.Game.Components.Add(m_kWallManager);

            m_kPlane = new CollisionLevelPiece(ScreenManager.Game, this, "checker_plane_3");
            m_kPlane.scale = 15;
            m_kPlane.position += new Vector3(50f, -10f, 0);
            ScreenManager.Game.Components.Add(m_kPlane);
        }