Exemplo n.º 1
0
    IEnumerator TimerCoroutine()
    {
        timer       = 0;
        playedSound = false;

        while (timer < Timer)
        {
            if (GameBoard.Current.isTimeStopped)
            {
                yield return(null);

                continue;
            }

            timer += Time.deltaTime * GameBoard.Current.DifficultyTimeScale;

            if (!playedSound && (timer / Timer) > 0.9f)
            {
                playedSound = true;
                SoundBoard.PlayBlockAppear();
            }

            _i.fillAmount = timer / Timer;
            tmpColor      = _i.color;
            tmpColor.a    = timer / Timer;
            _i.color      = tmpColor;
            yield return(null);
        }

        RealBlock.ActivatePending();
        GameBoard.Current.StartCoroutine(GameBoard.SPAWN_TIMER_COROUTINE);
        GameBoard.Current.TestForFailure();
        Despawn(this);
    }