Beispiel #1
0
        public IEnumerator ShowCountdownTime(int count, bool extraSound = false, float speed = 1.0f)
        {
            this.Countdown.gameObject.SetActive(true);
            var easing = new Shand.Easing();

            while (count > 0)
            {
                this.Countdown.text = count.ToString();
                easing.Start(Shand.EasingPattern.BounceOut, 0.5f * speed, 5.0f, 1.0f);

                while (!easing.Ended)
                {
                    var s = easing.UpdateValue(Time.deltaTime) * 1.0f;
                    this.Countdown.transform.localScale = new Vector3(s, s, 1.0f);
                    yield return(null);
                }

                SeManager.Instance.Play(Sound.SeKind.Countdown.ToString(), 0.0f, false, 1.0f);
                yield return(new WaitForSeconds(0.5f * speed));

                --count;
            }

            this.Countdown.gameObject.SetActive(false);
            Destroy(GameObject.Find("PauseWindow(Clone)"));

            if (onClose != null)
            {
                onClose();
            }
        }
Beispiel #2
0
        public void StartTimer(Action timeUpFunc, int durationFrame)
        {
            float waitTime = Util.TimeUtility.ConvertFrameToSec(durationFrame);

            this.timer = new Shand.Easing();
            this.timer.SetFinishEvent(() =>
            {
                this.timer = null;
                timeUpFunc();
            });
            this.timer.Start(Shand.EasingPattern.Linear, waitTime, 0.0f, 1.0f);
        }