Exemple #1
0
 public static void PauseSnake(object sender, KeyEventArgs e)
 {
     if (!instance.snake.isDead && e.KeyCode == Keys.Escape)
     {
         if (!Configerator.instance.IsLevelGame())
         {
             return;
         }
         if (!Configerator.instance.GamePaused && Configerator.instance.PausesLeft == 0)
         {
             return;
         }
         Configerator.instance.GamePaused = !Configerator.instance.GamePaused;
         WorldRenderer.UpdatePauseLabel();
         if (Configerator.instance.GamePaused)
         {
             --Configerator.instance.PausesLeft;
             Configerator.SaveConfig();
             WorldRenderer.UpdatePausesLeftLabel();
         }
     }
 }
Exemple #2
0
 public virtual void Die()
 {
     isDead = true;
     if (Configerator.instance.GameType == Configerator.Game.player)
     {
         if (Configerator.instance.IsLevelGame())
         {
             Configerator.instance.LevelLost();
             WorldRenderer.UpdateLifeLabel();
         }
         else if (Configerator.instance.IsHighScoreGame())
         {
             Configerator.instance.HighScore = Math.Max(Configerator.instance.HighScore, score);
             WorldRenderer.UpdateHighScoreLabel();
             Configerator.SaveConfig();
         }
         if (Configerator.instance.ActiveLevel.EnemySnakeEnabled)
         {
             WorldRenderer.instance.World.enemySnake.isDead = true;
         }
         WorldRenderer.ShowDeathDialog();
     }
 }