Пример #1
0
        private IEnumerator StartNewPhase(float seconds, LerpOverTime lerp)
        {
            yield return(new WaitForSeconds(seconds));

            _lerp = lerp;
            _lerp.Start();
        }
Пример #2
0
        // Update is called once per frame
        void Update()
        {
            if (_lerp != null)
            {
                _light.intensity = _lerp.Value;
            }

            if (isDayTime && _light.intensity == nightTimeLightIntensity)
            {
                _lerp = null;
                StartCoroutine(StartNewPhase(nightTimeInSeconds, new LerpOverTime(nightTimeLightIntensity, dayTimeLightIntensity, nightTimeToDayTransitionTime)));
                isDayTime = false;
            }
            else if (!isDayTime && _light.intensity == dayTimeLightIntensity)
            {
                _lerp     = null;
                isDayTime = true;
                StartCoroutine(StartNewPhase(dayTimeInSeconds, new LerpOverTime(dayTimeLightIntensity, nightTimeLightIntensity, dayTimeToNightTransitionTime)));
            }
        }