Exemple #1
0
    public IEnumerator TransitionLight(Weather from, Weather to, WeatherLighting weatherLighting)
    {
        float duration       = transitionDuration;
        float elapsedTime    = 0.0f;
        float lightIntensity = from.lightIntensity;

        while (elapsedTime <= duration)
        {
            // Transition scene lighting
            lightIntensity = Mathf.Lerp(from.lightIntensity, to.lightIntensity, elapsedTime / duration);
            weatherLighting.SetIntensity(lightIntensity);

            elapsedTime += Time.deltaTime;
            yield return(null);
        }
    }