Ejemplo n.º 1
0
        private void CounterDownTime()
        {
            if (_appController.IsSingleGameMode())
            // 单机模式下不计时。
            {
                return;
            }

            if (Content && Content.gameObject.activeSelf)
            {
                var leftTime = Mathf.RoundToInt(_endTime - Time.time);
                if (leftTime < 0)
                {
                    leftTime = 0;
                }

                if (TimeCounter)
                {
                    TimeCounter.text = "" + leftTime;
                }

                if (leftTime < 10)
                {
                    if (Time.time - _lastHurrySountTime >= 1)
                    {
                        _soundController.PlayHurrySound();
                        _lastHurrySountTime = Time.time;
                    }
                }
            }
        }