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);
 }
Example #2
0
        protected void OnValidate()
        {
            if (!_initialized)
            {
                return;
            }
            _skyboxController = SkyboxController.Instance;

            // Sky
            _skyParamsList.Update();

            // Stars
            if (_skyboxController.StarsEnabled)
            {
                _starsParamsList.Update();
            }

            // Sun
            if (_skyboxController.SunEnabled)
            {
                _sunParamsList.Update();

                // position
                _sunDuration = (_sunrise < _sunset) ? _sunset - _sunrise : 100f - _sunrise + _sunset;
                var radAngle = _sunAltitude * Mathf.Deg2Rad;
                _sunAttitudeVector = new Vector3(Mathf.Sin(radAngle), Mathf.Cos(radAngle));
            }

            // Moon
            if (_skyboxController.MoonEnabled)
            {
                _moonParamsList.Update();

                // position
                _moonDuration = (_moonrise < _moonset) ? _moonset - _moonrise : 100f - _moonrise + _moonset;
                var radAngle = _moonAltitude * Mathf.Deg2Rad;
                _moonAttitudeVector = new Vector3(Mathf.Sin(radAngle), Mathf.Cos(radAngle));
            }

            // Clouds
            if (_skyboxController.CloudsEnabled)
            {
                _cloudsParamsList.Update();
            }
        }