Ejemplo n.º 1
0
    public void OnGameEnd(bool won)
    {
        if (won)
        {
            mainText.text      = winMainText;
            feedbackText.color = mainText.color = winTextColor;
            background.color   = winBackgroundColor;
            UpdateScore();
            SetInteractablesColor(winInteractableColor);
            audioSource.clip = winAudioClip;
            audioSource.Play();
        }
        else if (cachedGameFlow.IsAlive())
        {
            mainText.text      = loseMainText;
            feedbackText.text  = loseSubText;
            feedbackText.color = mainText.color = loseTextColor;
            background.color   = loseBackgroundColor;
            SetInteractablesColor(loseInteractableColor);
            audioSource.clip = loseAudioClip;
            audioSource.Play();
        }
        else
        {
            mainText.text      = gameOverMainText;
            feedbackText.color = mainText.color = gameOverTextColor;
            restartButton.SetActive(true);
            continueButton.SetActive(false);
            background.color = gameOverBackgroundColor;
            UpdateScore();
            SetInteractablesColor(loseInteractableColor);
            audioSource.clip = loseAudioClip;
            audioSource.Play();
        }

        animation.Play(inAnimation.name);
    }