Пример #1
0
        protected override void Update(GameTime time)
        {
            GameTime = time;
            keyController.Update();
            padController.Update();
            TransitionScreen.Update(time);
            Music.Update();
            if (!GameVariables.Underground)
            {
                Camera.Update();
            }
            GameVariables.Update(time);

            if (CurrentState != GameState.GameOver && CurrentState != GameState.MainMenu && CurrentState != GameState.GameComplete)
            {
                if (CurrentState == GameState.Playing || CurrentState == GameState.End || CurrentState == GameState.Dead)
                {
                    CollisionDetector.Update();

                    GameLists.Update(GameTime);

                    for (int i = 0; i < Marios.Count; i++)
                    {
                        Marios[i].Update(GameTime);
                    }

                    HUD.Update(GameVariables.LevelTimer, new Vector2(Camera.Point.X, Camera.Point.Y), GameVariables.LevelNumber);
                }
            }

            base.Update(GameTime);
        }
Пример #2
0
 public void StartMainMenu()
 {
     CurrentState  = GameState.MainMenu;
     keyController = new KeyController();
     padController = new PadController();
     RegisterCommands();
     GameLists = new GameLists();
     Level.LoadLevel(0);
 }
Пример #3
0
        protected override void Draw(GameTime time)
        {
            GraphicsDevice.Clear(GameVariables.BackgroundColor);
            SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Camera.Transform);

            GameLists.Draw(SpriteBatch);
            for (int i = 0; i < Marios.Count; i++)
            {
                Marios[i].Draw(SpriteBatch);
            }
            HUD.Draw(SpriteBatch, SpriteFont, Color.White);
            base.Draw(GameTime);
            if (CurrentState != GameState.Playing)
            {
                if (CurrentState == GameState.MainMenu)
                {
                    TransitionScreen.Draw(SpriteBatch, SpriteFont, "MainMenu");
                }
                else if (CurrentState == GameState.Paused)
                {
                    TransitionScreen.Draw(SpriteBatch, SpriteFont, "Paused");
                }
                else if (CurrentState == GameState.GameOver)
                {
                    TransitionScreen.Draw(SpriteBatch, SpriteFont, "GameOver");
                }
                else if (CurrentState == GameState.Transition)
                {
                    TransitionScreen.Draw(SpriteBatch, SpriteFont, "Transition");
                }
                else if (CurrentState == GameState.GameComplete)
                {
                    TransitionScreen.Draw(SpriteBatch, SpriteFont, "GameComplete");
                }
            }

            SpriteBatch.End();
        }
Пример #4
0
 public void LevelReset()
 {
     if (GameVariables.Lives > 0)
     {
         GameVariables.CurrentlyAlive = GameVariables.PlayerNumber;
         GameLists = new GameLists();
         Level.LoadLevel(GameVariables.LevelNumber);
         CurrentState = GameState.Transition;
         TransitionScreen.TransitionTimer = 0;
         keyController = new KeyController();
         padController = new PadController();
         RegisterCommands();
         GameVariables.Underground     = false;
         GameVariables.BackgroundColor = Color.CornflowerBlue;
         MediaPlayer.IsRepeating       = true;
         GameVariables.LevelTimer      = GameVariables.TotalTime;
         GameVariables.ElapsedTime     = 0;
         GameVariables.PlayFinal       = true;
     }
     else
     {
         CurrentState = GameState.GameOver;
     }
 }