Exemplo n.º 1
0
    private void Update()
    {
        //if(Random.value > 0.9999f)
        //{
        //	weatherType = (WeatherType)Random.Range(1, 8);
        //	transitionCoroutine = StartCoroutine(UpdateWeatherSettings());
        //}


        //// Update the current time of day. Eventually this might be handled in a seperate time class
        UpdateTime(Time.deltaTime * TimeScale);

        //// Set shader global (Will only be used if timescale clouds is on.
        var time = SecondsPerDayRecip * SecondsOfDay;

        //Shader.SetGlobalFloat("_TimeOfDay", time);

        //// Update sun rotation
        RenderSettings.sun.transform.eulerAngles = sunRotation + sunAxis * time;

        //// A nice fade in/out equation (y = 1 - ((x - 12)/ 6) ^ 2);
        ////var intensity = (SecondsOfDay - midDaySeconds) / sunriseSeconds;
        ////sun.shadowStrength = 1 - intensity * intensity;

        currentWeatherSettings?.UpdateWeather(time);
    }
Exemplo n.º 2
0
    private void SetWeatherSettings(WeatherType weatherType)
    {
        currentWeatherSettings = ScriptableObject.CreateInstance <WeatherSettings>();
        currentWeatherSettings.Create(weatherType, skyboxMaterial);

        currentWeatherSettings.UpdateWeather(SecondsOfDay / SecondsPerDay);

        // Rain
        if (weatherType == WeatherType.Rain || weatherType == WeatherType.Thunderstorm)
        {
            rain.SetActive(true);
        }
        else
        {
            rain.SetActive(false);
        }
    }