Esempio n. 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);
             }
         }
     }
 }
Esempio n. 2
0
        protected void GameNotOverDraw(GameTime gameTime)
        {
            parser.Draw();
            trophy.Draw();
            Mario.Draw(spriteBatch);
            pauser.Draw();
            if ((Mario.Health() == MarioStateMachine.MarioHealth.Dead && deathDelayScreen > 70 && st.Lives >= 0 && !(UI.getTime() <= 0)) || changingLevel)
            {
                load.Draw(spriteBatch);
                if (delay > 100)
                {
                    changingLevel = false;
                    st.EndStarCombo();
                    deathDelayScreen = 0;
                    delay            = 0;

                    st.LoseLife();
                    st.AllowFlagpolePoints();
                    st.TimePoints(UI.Time);
                    UI.SetTimer(400);
                }
                else
                {
                    delay++;
                }
            }
            else if ((Mario.Health() == MarioStateMachine.MarioHealth.Dead && !(UI.getTime() <= 0) || changingLevel) && st.Lives < 0)
            {
                isGameOver    = true;
                changingLevel = false;
            }
            if (needBlackScreen)
            {
                load.BlackScreen();
                if (delay > 30)
                {
                    needBlackScreen = false;
                    delay           = 0;
                }
                else
                {
                    delay++;
                }
            }
            if (UI.getTime() <= 0)
            {
                if (Mario.Health() == MarioStateMachine.MarioHealth.Normal && !alreadyKilled)
                {
                    Mario.KillMario();
                    alreadyKilled = true;
                }
                if (deathDelayScreen > 70)
                {
                    load.TimeUp(spriteBatch);
                    if (delay > 150)
                    {
                        alreadyKilled = false;
                        st.EndStarCombo();
                        deathDelayScreen = 0;
                        delay            = 0;
                        st.LoseLife();
                        st.AllowFlagpolePoints();
                        st.TimePoints(UI.Time);
                        UI.SetTimer(400);
                    }
                    else
                    {
                        delay++;
                    }
                }
            }
            UI.Draw(spriteBatch);
            editor.Draw(spriteBatch);
            if (Mario.Health() == MarioStateMachine.MarioHealth.Dead)
            {
                deathDelayScreen++;
            }
            base.Draw(gameTime);
        }