private void HandleDeathAnimation(GameTime gameTime)
        {
            if (marioMovement != MarioMovement.Die)
            {
                return;
            }

            deathAnimTimeRemaining -= (float)gameTime.ElapsedGameTime.TotalSeconds;
            float move = deathAnimSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;

            //Move up from 5%-15%
            if (deathAnimTimeRemaining < 0.9167f * deathAnimLength && deathAnimTimeRemaining >= 0.74999f * deathAnimLength)
            {
                mario.ForceMove(0, -move);
            }
            //Then move down from 30%-100%
            else if (deathAnimTimeRemaining < 0.74999f * deathAnimLength)
            {
                mario.ForceMove(0, move);
            }

            //When we finish animation, reset level.
            if (deathAnimTimeRemaining <= ZERO)
            {
                MarioEvents.Reset(this, EventArgs.Empty);
                MarioGame.Instance.TriggerDeathSequence();
            }
        }
示例#2
0
 private void DisplayDeathScreen()
 {
     if (levelHUD != null)
     {
         levelHUD.Draw(spriteBatch, font, deathScreen, false);
     }
     if (deathScreenTimer < deathScreenCount)
     {
         deathScreenTimer++;
     }
     else
     {
         if (!gameComplete)
         {
             deathScreenTimer = Zero;
             deathScreen      = false;
             MarioEvents.Reset(null, null);
         }
     }
 }
 public void Reset()
 {
     MarioEvents.Reset(this, EventArgs.Empty);
     Score.Lives = 3;
 }