Beispiel #1
0
 public void DecreaseLives()
 {
     this.numberOfLives--;
     if (numberOfLives > 0)
     {
         MarioGame.GetInstance.ResetLevel();
     }
     else
     {
         PlayState.GetInstance().GameOver();
     }
 }
Beispiel #2
0
        public void Update(GameTime gameTime)
        {
            ellapsedTimer += gameTime.ElapsedGameTime.Milliseconds;

            if (addTimeToPoints)
            {
                if (ellapsedTimer >= 60)
                {
                    timeRemaining -= 20;
                    ellapsedTimer  = 0;
                    AddPoints(20 * 10);
                    if (timeRemaining <= 0)
                    {
                        AddPoints(timeRemaining * 10);
                        timeRemaining = 0;
                        PlayState.GetInstance().Win();
                    }
                    else
                    {
                        Sounds.SoundPlayer.GetInstance().PlaySoundEffect(Sounds.SoundEffectNames.Coin);
                    }
                }
            }
            else if (ellapsedTimer >= 1000)
            {
                if (timeRemaining > 0)
                {
                    timeRemaining--;
                    ellapsedTimer = 0;
                    if (timeRemaining == 75)
                    {
                        Systems.Events.TheInstance.Timer();
                    }
                }
            }

            this.coin.Update(gameTime, this.graphicsDevice);
            this.staticMario.Update(gameTime, this.graphicsDevice);
        }