Example #1
0
 // Restart the game
 // Give the player the lives back
 // Reset the state
 public void RestartGame()
 {
     if (GameState == GameStates.End && Lives <= 0)
     {
         Lives = 3;
     }
     OnGameRestart?.Invoke(GameState);
     Invoke("StartGame", 3);
     GameState = GameStates.Running;
 }
Example #2
0
        public void EndGame()
        {
            inventory.energy.SetValue(0);
            inventory.health.SetValue(0);
            inventory.keyLrg.SetValue(0);
            inventory.keySml.SetValue(0);
            inventory.score.SetValue(0);
            OnGameEnd?.Invoke();

            OnGameRestart?.Invoke();
        }
Example #3
0
 // Restarts the game by reloading the current scene
 /// <summary>
 /// Restarts the game.
 /// </summary>
 public void RestartGame()
 {
     GameOver = false;
     OnGameRestart?.Invoke();
     StartGame();
 }
Example #4
0
 public void Restart()
 {
     HideGameOverScreen();
     OnGameRestart?.Invoke();
 }
 public void RestartGame()
 {
     isGameOver = false;
     SceneManager.LoadScene("PigGame");
     OnGameRestart?.Invoke();
 }
Example #6
0
 public void OnGameRestart_Event()
 {
     OnGameRestart?.Invoke(this, EventArgs.Empty);
 }
Example #7
0
 public void Restart()
 {
     OnGameRestart?.Invoke();
 }