Exemplo n.º 1
0
        public void UpdateByTime(float time)
        {
            m_ambientData = GetAmbientData(time);
            SetAmbientData(m_ambientData);

            m_timeData = GetTimeData(time);
            SetTimeData(m_timeData);
        }
Exemplo n.º 2
0
        private void SetTimeData(WeatherTimeData timeData)
        {
            Quaternion rotation = Quaternion.Euler(new Vector3(0, 0, timeData.SunAngle));

            m_light.transform.rotation = rotation * Quaternion.Euler(Vector3.up * (timeData.Time * 360f + 90f));

            float atmosphereThickness = Mathf.Abs(timeData.Time - 0.5f) * 4;

            atmosphereThickness = Mathf.Lerp(timeData.AtmosphereThicknessMin, timeData.AtmosphereThicknessMax, Mathf.Clamp01(atmosphereThickness));
            RenderSettings.skybox.SetFloat("_AtmosphereThickness", atmosphereThickness);
        }
Exemplo n.º 3
0
        public void InitData(WeatherAmbientData targetData, WeatherTimeData timeData, WeatherEffect weatherEffect, Light light)
        {
            m_currentAmbientData = m_ambientData;
            m_targetAmbientData  = targetData;

            m_currentTimeData = m_timeData;
            m_targetTimeData  = timeData;
            m_weatherEffect   = weatherEffect;
            m_light           = light;

            m_light.shadows = targetData.ShadowType;
        }
Exemplo n.º 4
0
        private WeatherTimeData GetTimeData(float time)
        {
            WeatherTimeData timeData = new WeatherTimeData();

            timeData.SunAngle = Mathf.Lerp(m_currentTimeData.SunAngle, m_targetTimeData.SunAngle, time);
            timeData.AtmosphereThicknessMin = Mathf.Lerp(m_currentTimeData.AtmosphereThicknessMin, m_targetTimeData.AtmosphereThicknessMin, time);
            timeData.AtmosphereThicknessMax = Mathf.Lerp(m_currentTimeData.AtmosphereThicknessMax, m_targetTimeData.AtmosphereThicknessMax, time);
            timeData.Time      = Mathf.Lerp(m_currentTimeData.Time, m_targetTimeData.Time, time);
            timeData.TimeSpeed = Mathf.Lerp(m_currentTimeData.TimeSpeed, m_targetTimeData.TimeSpeed, time);
            timeData.AutoTime  = m_targetTimeData.AutoTime;
            return(timeData);
        }