Пример #1
0
    private void ResetGameStats()
    {
        GameTimer = SettingsManager.GameTimer;
        SettingsManager.HighScore = GetHighScore();
        IsPaused = false;
        if (CurrentLevelIndex >= 1)
        {
            if (MonoFactory.Instance != null)
            {
                MonoFactory.ReturnAllChildren();
            }

            if (LevelBuilder.Instance != null)
            {
                LevelBuilder.Instance.LevelIndex = CurrentLevelIndex - 1;

                LevelBuilder.Instance.BuildLevel();
            }
            if (!SettingsManager.OverWriteLevelSettings)
            {
                SettingsManager.Instance.SetSettings(CurrentLevelIndex);
            }
            if (_playerTwo != null && _playerOne != null)
            {
                ResetPlayer();
            }
        }
        CurrentLevelIndex++;
        LevelChanged = true;
    }
Пример #2
0
 private void OnBackToMenuButtonClicked()
 {
     GameController.Instance.GameOver -= (winner) => OnGameOver(winner);
     GameController.Instance.ResetCombinedPlayerScore();
     SettingsManager.HighScore = GameController.Instance.GetHighScore();
     GameController.Instance.CurrentLevelIndex = 0;
     MonoFactory.ReturnAllChildren();
     GameController.Instance.LoadLevelWithIndex(0);
 }
Пример #3
0
    private void OnGameOver(PlayerController winner)
    {

        if (_GameOverText != null)
        {
            _GameOverText.gameObject.SetActive(true);
            _playerOneScore.gameObject.SetActive(true);
            _playerTwoScore.gameObject.SetActive(true);
            _playerOneScore.text = GameController.Instance.CombinedScorePlayerOne.ToString();
            _playerTwoScore.text = GameController.Instance.CombinedScorePlayerTwo.ToString();
            if (winner != null)
            {
                _GameOverText.text = winner.name + " has Won!";
            }
            else
            {
                _GameOverText.text = "tie!";
            }
            MonoFactory.ReturnAllChildren();
            ToggleGameMenu();
        }
    }