Beispiel #1
0
        /// <summary>
        /// Starts countdown UI. Based on Stage GUI's CountdownClips array.
        /// Each Countdown Audio Clip's length influences how long the text is displayed
        /// Returns when GO! is reached, but GO! will continue to be displayed for its duration
        /// </summary>
        /// <param name="evt"></param>
        /// <returns></returns>
        async Task StartCountdown(MatchStartCountdownEvent evt)
        {
            // For Debug purposes and you don't want to wait
            if (DisableCountdown && Debug.isDebugBuild)
            {
                return;
            }

            if (InitialDelay > 0)
            {
                await Task.Delay((int)(InitialDelay * 1000));
            }
            ObjectUtil.SetActive(TextUI.gameObject, true);

            for (var i = 0; i < CountdownClips.Length; i++)
            {
                if (i < CountdownClips.Length - 1)
                {
                    await UpdateTextUI(CountdownClips[i]);
                }
                else
                {
                    UpdateTextUIGO(CountdownClips[i]);
                }
            }
        }
        /// <summary>
        /// Starts countdown UI. Based on Stage GUI's CountdownClips array.
        /// Each Countdown Audio Clip's length influences how long the text is displayed
        /// Returns when GO! is reached, but GO! will continue to be displayed for its duration
        /// </summary>
        /// <param name="evt"></param>
        /// <returns></returns>
        async Task StartCountdown(MatchStartCountdownEvent evt)
        {
            // For Debug purposes and you don't want to wait
            if (DisableCountdown && Debug.isDebugBuild)
            {
                return;
            }

            await Task.Delay((int)(InitialDelay * 1000));

            ObjectUtil.SetActive(TextUI.gameObject, true);

            var timer = CountdownClips.Length - 1;

            while (timer > 0)
            {
                await UpdateTextUI(timer.ToString(), CountdownClips[timer]);

                timer--;
            }
            // TODO: Make GO! string into localization string
            UpdateTextUIGO("GO!", CountdownClips[0]);
        }