private void UpdateMoon() { if (!_skyboxController.MoonEnabled) { return; } // 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); rotation.eulerAngles = new Vector3(rotation.eulerAngles.x, rotation.eulerAngles.y, 0); _skyboxController.MoonLight.transform.rotation = rotation; } // colors CurrentMoonParam = _moonParamsList.GetParamPerTime(TimeOfDay); _skyboxController.MoonTint = CurrentMoonParam.TintColor; _skyboxController.MoonLight.color = CurrentMoonParam.LightColor; _skyboxController.MoonLight.intensity = CurrentMoonParam.LightIntencity; }
public void Start() { _skyboxController = SkyboxController.Instance; CurrentSkyParam = _skyParamsList.GetParamPerTime(TimeOfDay); CurrentStarsParam = _starsParamsList.GetParamPerTime(TimeOfDay); CurrentSunParam = _sunParamsList.GetParamPerTime(TimeOfDay); CurrentMoonParam = _moonParamsList.GetParamPerTime(TimeOfDay); }