Example #1
0
    private IEnumerator FirstFadeCO(float _seconds)
    {
        #region Fading score

        buttonScoreText.text = score.ToString();

        if (score.Equals(0))
        {
            buttonScoreText.color = new Color(1, 0, 0, 0);
        }
        else if (score.Equals(5))
        {
            buttonScoreText.color = new Color(1, 0.92f, 0.016f, 0);
        }
        else if (score.Equals(10))
        {
            buttonScoreText.color = new Color(0, 1, 0, 0);
        }

        buttonScoreText.transform.position = this.transform.position + new Vector3(0, 25f, 0);

        Color newColor = buttonScoreText.color;

        while (newColor.a < 1)
        {
            newColor.a           += Time.deltaTime;
            buttonScoreText.color = newColor;
            yield return(null);
        }

        #endregion

        yield return(new WaitForSecondsRealtime(_seconds));

        #region Choose coroutine

        if (score.Equals(0))
        {
            StartCoroutine(ScoreAnswerNullCO(0.5f));
            multiplierText.GetComponent <Text>().text = "x 0";
        }
        else
        {
            StartCoroutine(AcceptAnswerCO(0.5f));
        }

        #endregion
    }