public void Start()
 {
     _skyboxController  = SkyboxControllerSimple.Instance;
     CurrentSkyParam    = _skyParamsList.GetParamPerTime(TimeOfDay);
     CurrentStarsParam  = _starsParamsList.GetParamPerTime(TimeOfDay);
     CurrentCloudsParam = _cloudsParamsList.GetParamPerTime(TimeOfDay);
 }
Exemple #2
0
 private void UpdateClouds()
 {
     if (!_skyboxController.CloudsEnabled)
     {
         return;
     }
     CurrentCloudsParam           = _cloudsParamsList.GetParamPerTime(TimeOfDay);
     _skyboxController.CloudsTint = CurrentCloudsParam.TintColor;
 }
Exemple #3
0
 public void Start()
 {
     _skyboxController  = SkyboxController.Instance;
     CurrentSkyParam    = _skyParamsList.GetParamPerTime(TimeOfDay);
     CurrentStarsParam  = _starsParamsList.GetParamPerTime(TimeOfDay);
     CurrentSunParam    = _sunParamsList.GetParamPerTime(TimeOfDay);
     CurrentMoonParam   = _moonParamsList.GetParamPerTime(TimeOfDay);
     CurrentCloudsParam = _cloudsParamsList.GetParamPerTime(TimeOfDay);
     _initialized       = true;
 }
        public void Update()
        {
            // Sky colors
            CurrentSkyParam = _skyParamsList.GetParamPerTime(TimeOfDay);

            _skyboxController.TopColor    = CurrentSkyParam.TopColor;
            _skyboxController.MiddleColor = CurrentSkyParam.MiddleColor;
            _skyboxController.BottomColor = CurrentSkyParam.BottomColor;
            _skyboxController.CloudsTint  = CurrentSkyParam.CloudsTint;

            // Stars colors
            CurrentStarsParam           = _starsParamsList.GetParamPerTime(TimeOfDay);
            _skyboxController.StarsTint = CurrentStarsParam.TintColor;

            // Sun rotation
            if (TimeOfDay > _sunrise || TimeOfDay < _sunset)
            {
                var sunCurrent = (_sunrise < TimeOfDay) ? TimeOfDay - _sunrise : 100f + TimeOfDay - _sunrise;
                var ty         = (sunCurrent < _sunDuration) ? sunCurrent / _sunDuration : (_sunDuration - sunCurrent) / _sunDuration;
                var dy         = Mathf.Lerp(_sunOrbit.x, _sunOrbit.y, ty);
                var rotation   = Quaternion.AngleAxis(_sunLongitude - 180, Vector3.up) * Quaternion.AngleAxis(dy, _sunAttitudeVector);
                _skyboxController.SunLight.transform.rotation = rotation;
            }

            // Sun colors
            CurrentSunParam = _sunParamsList.GetParamPerTime(TimeOfDay);

            _skyboxController.SunTint            = CurrentSunParam.TintColor;
            _skyboxController.SunLight.color     = CurrentSunParam.LightColor;
            _skyboxController.SunLight.intensity = CurrentSunParam.LightIntencity;

            // Moon rotation
            if (TimeOfDay > _moonrise || TimeOfDay < _moonset)
            {
                var moonCurrent = (_moonrise < TimeOfDay) ? TimeOfDay - _moonrise : 100f + TimeOfDay - _moonrise;
                var ty          = (moonCurrent < _moonDuration) ? moonCurrent / _moonDuration : (_moonDuration - moonCurrent) / _moonDuration;
                var dy          = Mathf.Lerp(_moonOrbit.x, _moonOrbit.y, ty);
                var rotation    = Quaternion.AngleAxis(_moonLongitude - 180, Vector3.up) * Quaternion.AngleAxis(dy, _moonAttitudeVector);
                _skyboxController.MoonLight.transform.rotation = rotation;
            }

            // Moon colors
            CurrentMoonParam = _moonParamsList.GetParamPerTime(TimeOfDay);

            _skyboxController.MoonTint            = CurrentMoonParam.TintColor;
            _skyboxController.MoonLight.color     = CurrentMoonParam.LightColor;
            _skyboxController.MoonLight.intensity = CurrentMoonParam.LightIntencity;

            // Clouds colors
            CurrentCloudsParam           = _cloudsParamsList.GetParamPerTime(TimeOfDay);
            _skyboxController.CloudsTint = CurrentCloudsParam.TintColor;
        }
        public void Update()
        {
            // Sky colors
            CurrentSkyParam = _skyParamsList.GetParamPerTime(TimeOfDay);

            _skyboxController.TopColor    = CurrentSkyParam.TopColor;
            _skyboxController.MiddleColor = CurrentSkyParam.MiddleColor;
            _skyboxController.BottomColor = CurrentSkyParam.BottomColor;
            _skyboxController.CloudsTint  = CurrentSkyParam.CloudsTint;

            // Stars colors
            CurrentStarsParam           = _starsParamsList.GetParamPerTime(TimeOfDay);
            _skyboxController.StarsTint = CurrentStarsParam.TintColor;

            // Clouds colors
            CurrentCloudsParam           = _cloudsParamsList.GetParamPerTime(TimeOfDay);
            _skyboxController.CloudsTint = CurrentCloudsParam.TintColor;
        }