Exemple #1
0
    private void EndGame()
    {
        PauseGame(showMenu: false);

        string gameOverText = Profile.DefaultGameOverText;

        for (int i = 0; i < Profile.EndResults.Length; i++)
        {
            var result = Profile.EndResults[i];

            if (CurrentScore.CompareValues(result.ScoreCondition.Comparison, result.ScoreCondition.Value))
            {
                gameOverText = result.GameOverText;
                break;
            }
        }

        // Subscribe to when the player clicks the close button to go back to the main menu.
        Dialogue.OnSecondaryClick.AddListener(ReturnToMenu);

        // Show end dialogue.
        OnPopupTrigger(Profile.PlayerName, gameOverText, Profile.PlayerAvatar, gameObject);
    }