Beispiel #1
0
        private void Start()
        {
            m_instance     = this;
            WeatherPresent = CheckWeatherPresent();
            UpdateGaiaTimeOfDay(false);

            if (m_sunLight == null)
            {
                m_sunLight = GaiaUtils.GetMainDirectionalLight();
            }
            if (m_sunLight != null)
            {
                m_sunLightExists = true;
            }

            if (m_moonLight == null)
            {
                GameObject moonObject = GameObject.Find("Moon Light");
                if (moonObject != null)
                {
                    m_moonLight = moonObject.GetComponent <Light>();
                }
            }
#if GAIA_PRO_PRESENT
            if (m_moonLight != null)
            {
                m_moonLightExists = true;
            }
#endif
        }
Beispiel #2
0
        private void OnEnable()
        {
            //Get Gaia Lighting Profile object
            m_profile = (GaiaGlobal)target;

            if (m_editorUtils == null)
            {
                // Get editor utils for this
                m_editorUtils = PWApp.GetEditorUtils(this);
            }

            if (m_gaiaSettings == null)
            {
                m_gaiaSettings = GaiaUtils.GetGaiaSettings();
            }

            if (m_profile.SceneProfile == null)
            {
                m_profile.SceneProfile = ScriptableObject.CreateInstance <SceneProfile>();
            }

            if (m_profile.SceneProfile.m_selectedLightingProfileValuesIndex > m_profile.SceneProfile.m_lightingProfiles.Count - 1)
            {
                m_profile.SceneProfile.m_selectedLightingProfileValuesIndex = 1;
            }

            if (m_profile.SceneProfile.m_selectedWaterProfileValuesIndex > m_profile.SceneProfile.m_waterProfiles.Count - 1)
            {
                m_profile.SceneProfile.m_selectedWaterProfileValuesIndex = 1;
            }

            m_profile.SceneProfile.ProfileVersion = PWApp.CONF.Version;

#if GAIA_PRO_PRESENT
            if (ProceduralWorldsGlobalWeather.Instance != null)
            {
                LoadSettings();
            }
#endif
            if (dropdownGUIStyle == null)
            {
                dropdownGUIStyle = new GUIStyle(EditorStyles.popup)
                {
                    fixedHeight = 16f, margin = new RectOffset(0, 0, 4, 0)
                };
            }

            if (m_profile.SceneProfile.m_lightingProfiles.Count > 0)
            {
                if (m_profile.SceneProfile.m_selectedLightingProfileValuesIndex != -99)
                {
                    GaiaLightingProfileValues profileValues = m_profile.SceneProfile.m_lightingProfiles[m_profile.SceneProfile.m_selectedLightingProfileValuesIndex];
                    GaiaSceneManagement.FetchSceneSettigns(m_profile.SceneProfile, profileValues);
                }
            }
        }
Beispiel #3
0
        public void OnEnable()
        {
            m_instance     = this;
            WeatherPresent = CheckWeatherPresent();

            if (!Application.isPlaying)
            {
                if (m_lightingProfile == null)
                {
                    return;
                }

                if (m_waterProfile == null)
                {
                    return;
                }

                if (m_gaiaSettings == null)
                {
                    m_gaiaSettings = GaiaUtils.GetGaiaSettings();
                    if (m_gaiaSettings == null)
                    {
                        return;
                    }
                }
            }

            if (m_mainCamera == null)
            {
                m_mainCamera = GaiaUtils.GetCamera();
            }

            if (m_sunLight == null)
            {
                m_sunLight = GaiaUtils.GetMainDirectionalLight();
            }

            if (m_moonLight == null)
            {
                GameObject moonObject = GameObject.Find("Moon Light");
                if (moonObject != null)
                {
                    m_moonLight = moonObject.GetComponent <Light>();
                }
            }

            UpdateGaiaTimeOfDay(false);
            CheckPostProcessingFog(true);
        }
Beispiel #4
0
        /// <summary>
        /// Updates the underwater post fx
        /// </summary>
        private void UpdateUnderwaterPostFX()
        {
            if (m_supportPostFX)
            {
#if UNITY_POST_PROCESSING_STACK_V2
                if (m_postProcessProfile == null)
                {
                    if (m_underwaterPostFX != null)
                    {
                        PostProcessVolume processVolume = m_underwaterPostFX.GetComponent <PostProcessVolume>();
                        if (processVolume != null)
                        {
                            m_postProcessProfile = processVolume.sharedProfile;
                        }
                    }
                }
                else
                {
                    UnityEngine.Rendering.PostProcessing.ColorGrading colorGrading;
#if GAIA_PRO_PRESENT
                    if (!m_weatherSystemExists)
                    {
#endif
                    if (m_postProcessProfile.TryGetSettings(out colorGrading))
                    {
                        colorGrading.postExposure.value         = m_constUnderwaterPostExposure;
                        colorGrading.postExposure.overrideState = true;
                        colorGrading.colorFilter.value          = m_constUnderwaterColorFilter;
                        colorGrading.colorFilter.overrideState  = true;
                    }
#if GAIA_PRO_PRESENT
                }
                else
                {
                    if (m_postProcessProfile.TryGetSettings(out colorGrading))
                    {
                        colorGrading.postExposure.value         = m_gradientUnderwaterPostExposure.Evaluate(GaiaGlobal.GetTimeOfDayMainValue());
                        colorGrading.postExposure.overrideState = true;
                        colorGrading.colorFilter.value          = m_gradientUnderwaterColorFilter.Evaluate(GaiaGlobal.GetTimeOfDayMainValue());
                        colorGrading.colorFilter.overrideState  = true;
                    }
                }
#endif
                }
#endif
            }
        }