Пример #1
0
 protected override void Update(GameTime gameTime)
 {
     if (atMainMenu)
     {
         home.Update();
     }
     else
     {
         pauser.Update();
         trophy.Update();
         if (!pauser.isPaused())
         {
             cheats.Update();
             if (Mario.Health() == MarioStateMachine.MarioHealth.Dead)
             {
                 countToRestart--;
             }
             if (countToRestart == 0)
             {
                 countToRestart = 100;
                 changer.changeLevel();
                 LevelChanger.SetBGMusic(curLevel);
             }
             if (EnableControls)
             {
                 keyboard.Update(gameTime);
                 gamepad.Update(gameTime);
                 mouse.Update(gameTime);
                 RumbleHelper.Update(gameTime);
             }
             if (!changingLevel)
             {
                 Mario.Update(gameTime);
                 parser.Update();
             }
             MainCamera.Update(Mario);
             load.Update();
             UI.Update(gameTime);
             if (!timerEnabled)
             {
                 UI.StopTimer();
             }
             parser.ToggleCastle(toggleCastle);
             base.Update(gameTime);
         }
         else
         {
             pauser.Update();
             if (EnableControls)
             {
                 keyboard.Update(gameTime);
                 gamepad.Update(gameTime);
                 mouse.Update(gameTime);
                 RumbleHelper.Update(gameTime);
             }
         }
     }
 }
Пример #2
0
 protected override void Draw(GameTime gameTime)
 {
     if (atMainMenu)
     {
         home.Draw(spriteBatch, GraphicsDevice);
     }
     else
     {
         if (!(curLevel.Contains("Underground") || curLevel.Contains("Four")))
         {
             GraphicsDevice.Clear(Color.CornflowerBlue);
         }
         else
         {
             GraphicsDevice.Clear(Color.Black);
         }
         if (!isGameOver)
         {
             GameNotOverDraw(gameTime);
         }
         else
         {
             MusicManager.Instance.StopBackgroundMusic();
             parser.Draw();
             Mario.Draw(spriteBatch);
             UI.Draw(spriteBatch);
             trophy.Draw();
             if (delay > 150)
             {
                 load.GameOver(spriteBatch);
                 if (!soundPlayed)
                 {
                     MarioWorldSoundBoard.Instance.PlayGameOver();
                     soundPlayed = true;
                 }
                 else if (soundPlayed && delay > 350)
                 {
                     changer.changeLevel();
                     LevelChanger.SetBGMusic(curLevel);
                     delay       = 0;
                     soundPlayed = false;
                     st          = new ScoreTracker();
                     isGameOver  = false;
                 }
             }
             delay++;
         }
     }
 }