void FixedUpdate()
        {
            _atmsphrOffset = PresetContainer.Instance.atmsphrOffset;
            //set fog color
            RenderSettings.fogColor = FogGradient.Evaluate(SkyMan.TimeRatio);

            //set sky Material ground color & atmo. thickness
            SkyMat.SetFloat("_AtmosphereThickness", AtmosphereCurve.Evaluate(SkyMan.TimeRatio) + _atmsphrOffset); //1
            _groundColor = HorizonGradient.Evaluate(SkyMan.TimeRatio);
            SkyMat.SetColor("_GroundColor", _groundColor);

            if (SkyMan.UseSunFlare && !(SkyMan.IsOvercast || SkyMan.IsNight))
            {
                if (!SunFlare)
                {
                    Debug.Log("ESKY: Ambient Controller couldnt find Sun Flare");
                    return;
                }
                else if (!SkyMan.IsNight)
                {
                    SunFlare.enabled = true;
                }
                else
                {
                    SunFlare.enabled = false;
                }
            }
            else
            {
                SunFlare.enabled = false;
            }
        }
        /// <summary>
        /// Selects gradients for fog & ground (horizon of procedural sky) based on isOvercast.  Disables sun flare if
        /// overcast, and sets various settings for sky before starting SetAmbient coroutine.
        /// </summary>
        /// <param name="isOverCast"></param>
        public void Init(bool isOverCast)
        {
            if (isOverCast)
            {
                FogGradient     = PresetContainer.Instance.fogOver;
                HorizonGradient = PresetContainer.Instance.colorOver;
                AtmosphereCurve = PresetContainer.Instance.atmosphereOver;
                SkyMat.SetFloat("_Exposure", .3f);                              //##TODO - add to presets
                SunFlare.enabled = false;
            }
            else
            {
                FogGradient     = PresetContainer.Instance.fogBase;
                HorizonGradient = PresetContainer.Instance.colorBase;
                AtmosphereCurve = PresetContainer.Instance.atmosphereBase;
                SkyMat.SetFloat("_Exposure", .5f);
            }

            SetSkyObjectSize();


            _skyTint = PresetContainer.Instance.skyTint;
            SkyMat.SetColor("_SkyTint", _skyTint);
            _atmsphrOffset = PresetContainer.Instance.atmsphrOffset;
        }
Example #3
0
        /// <summary>
        /// Selects gradients for fog & ground (horizon of procedural sky) based on isOvercast.  Disables sun flare if
        /// overcast, and sets various settings for sky before starting SetAmbient coroutine.
        /// </summary>
        /// <param name="isOverCast"></param>
        public void Init(bool isOverCast)
        {
            Debug.Log("in AmbientFogLightController init");
            if (isOverCast)
            {
                FogGradient = PresetContainer.Instance.fogOver;
                if (FogGradient == null)
                {
                    Debug.Log("FogGradient is null (overcast)");
                }
                else
                {
                    Debug.Log("FogGradient != null (overcast)");
                }
                HorizonGradient = PresetContainer.Instance.colorOver;
                AtmosphereCurve = PresetContainer.Instance.atmosphereOver;
                SkyMat.SetFloat("_Exposure", .3f);                              //##TODO - add to presets
                SunFlare.enabled = false;
            }
            else
            {
                FogGradient = PresetContainer.Instance.fogBase;
                if (FogGradient == null)
                {
                    Debug.Log("FogGradient is null");
                }
                else
                {
                    Debug.Log("FogGradient != null");
                }
                HorizonGradient = PresetContainer.Instance.colorBase;
                AtmosphereCurve = PresetContainer.Instance.atmosphereBase;
                SkyMat.SetFloat("_Exposure", .5f);
            }

            SetSkyObjectSize();

            //flareLayer = this.transform.Find("SkyCam").gameObject.GetComponent<FlareLayer>();
            goSun    = this.transform.Find("Rotator").Find("Sun").gameObject;
            sunLight = goSun.GetComponent <Light>();
            goSun    = this.transform.Find("Rotator").Find("Sun").gameObject;

            _skyTint = PresetContainer.Instance.skyTint;
            SkyMat.SetColor("_SkyTint", _skyTint);
            _atmsphrOffset = PresetContainer.Instance.atmsphrOffset;
        }
Example #4
0
        public void SkyObjectSizeChange(SkyObjectSize size)
        {
            SkyObjectSizeSetting = size;
            if (!EnhancedSkyCurrentToggle || SkyMat == null)
            {
                //Debug.Log("Sky Material was null");
                return;
            }

            if (size == SkyObjectSizes.Normal)
            {
                SkyMat.SetFloat("_SunSize", PresetContainer.SUNSIZENORMAL);
            }
            else
            {
                SkyMat.SetFloat("_SunSize", PresetContainer.SUNSIZELARGE);
            }


            if (updateSkySettingsEvent != null)
            {
                updateSkySettingsEvent();
            }
        }