Esempio n. 1
0
    /// <summary>
    /// Covers the transition between an active submission state to a validation state.
    /// </summary>
    internal IEnumerator ExitSubmit()
    {
        _init.isAnimated     = true;
        _init.isCountingDown = false;

        _pho.PlaySound("endSubmit");

        // ElasticOut ease of buttons going down.
        float k = 0;

        while (k <= 1)
        {
            _pho.Panel.transform.localPosition = new Vector3(0, (0.035f * Function.ElasticOut(1 - k)) - 0.025f, 0);
            k += 0.00390625f;
            yield return(new WaitForSecondsRealtime(0.01f));
        }

        // ElasticOut ease of screen going up.
        k = 1;
        while (k > 0)
        {
            _pho.Screen.transform.localPosition = new Vector3(-0.015f, (0.02f * Function.ElasticOut(1 - k)) - 0.015f, -0.016f);
            k -= 0.015625f;
            yield return(new WaitForSecondsRealtime(0.01f));
        }

        // Validation check.
        if (_init.solution == _init.submission)
        {
            _pho.StartCoroutine(_init.Solve());
        }
        else
        {
            _pho.StartCoroutine(_init.BufferStrike());
        }

        // Make the module inactive.
        _init.isAnimated     = false;
        _init.isInSubmission = false;
        _init.isSelected     = false;

        _pho.ButtonGroupRenderer.localScale = new Vector3(0, 0, 0);
    }
Esempio n. 2
0
    /// <summary>
    /// Starts a countdown, and attempts a strike if it reaches the end. Make sure that _time is set before running a coroutine with this method.
    /// </summary>
    internal IEnumerator Countdown()
    {
        _init.isCountingDown = true;
        _pho.PlaySound("voice_go");

        for (time = currentTime; time >= 1; time--)
        {
            if (!_init.isCountingDown)
            {
                yield break;
            }

            _pho.PlaySoundFromTime(time, time == currentTime);
            UpdateDisplay(time);

            yield return(new WaitForSecondsRealtime(1));
        }

        UpdateDisplay(0);
        _pho.StartCoroutine(_init.BufferStrike());
    }