Ejemplo n.º 1
0
        private void OnEnable()
        {
            m_instance = this;
            if (m_mainLight == null)
            {
                m_mainLight = GaiaUtils.GetMainDirectionalLight();
            }

            if (m_audioSource != null)
            {
                m_audioSource.playOnAwake = false;
            }

            if (m_audioSourceUnderwater != null)
            {
                m_audioSourceUnderwater.playOnAwake = false;
            }

            if (m_underwaterMaterial == null)
            {
                m_underwaterMaterial = GaiaUtils.GetWaterMaterial(GaiaConstants.waterSurfaceObject, true);
            }

            SetupTransitionVFX(m_enableTransitionFX);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the underwater status
        /// </summary>
        /// <returns></returns>
        public static bool IsUnderWater()
        {
            bool underwater = false;
            GaiaUnderwaterEffects gaiaUnderwaterEffects = FindObjectOfType <GaiaUnderwaterEffects>();

            if (gaiaUnderwaterEffects != null)
            {
                underwater = gaiaUnderwaterEffects.IsUnderwater;
            }

            return(underwater);
        }
Ejemplo n.º 3
0
        private void OnEnable()
        {
            //Get Profile object
            m_profile = (GaiaUnderwaterEffects)target;
            if (m_editorUtils == null)
            {
                // Get editor utils for this
                m_editorUtils = PWApp.GetEditorUtils(this);
            }

            m_renderPipeline = GaiaUtils.GetActivePipeline();
        }
Ejemplo n.º 4
0
        private void Start()
        {
            RenderPipeline = GaiaUtils.GetActivePipeline();
            m_instance     = this;

#if GAIA_PRO_PRESENT
            m_weatherSystemExists = ProceduralWorldsGlobalWeather.Instance;
#endif
            if (PWS_WaterSystem.Instance != null)
            {
                m_seaLevel = PWS_WaterSystem.Instance.SeaLevel;
            }

            if (m_playerCamera == null)
            {
                if (Camera.main != null)
                {
                    m_playerCamera = Camera.main.transform;
                }
            }
            if (m_playerCamera != null)
            {
                if (m_playerCamera.position.y > m_seaLevel)
                {
                    m_startingUnderwater = false;
                }
                else
                {
                    m_startingUnderwater = true;
                }
            }

            if (m_underwaterMaterial == null)
            {
                m_underwaterMaterial = GaiaUtils.GetWaterMaterial(GaiaConstants.waterSurfaceObject, true);
            }

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

            if (m_audioSource == null)
            {
                m_audioSource = GetAudioSource();
            }

            if (m_audioSourceUnderwater == null)
            {
                m_audioSourceUnderwater = GetAudioSource();
            }

            if (Application.isPlaying)
            {
                if (m_underwaterPostFX != null)
                {
                    m_underwaterPostFX.SetActive(true);
                }

                if (m_underwaterTransitionPostFX != null)
                {
                    m_underwaterTransitionPostFX.SetActive(true);
                }
            }

            if (m_audioSourceUnderwater != null)
            {
                m_audioSourceUnderwater.clip   = m_underwaterSoundFX;
                m_audioSourceUnderwater.loop   = true;
                m_audioSourceUnderwater.volume = m_playbackVolume;
                m_audioSourceUnderwater.Stop();
            }

            if (m_underwaterParticles != null)
            {
                m_underwaterParticleSystem = m_underwaterParticles.GetComponent <ParticleSystem>();
                if (m_underwaterParticleSystem != null)
                {
                    m_underwaterParticleSystem.Stop();
                }

                m_underwaterParticles.SetActive(false);
            }

            if (m_horizonObject != null)
            {
                m_horizonObject.SetActive(true);
                MeshRenderer[] meshRenders = m_horizonObject.GetComponentsInChildren <MeshRenderer>();
                foreach (MeshRenderer render in meshRenders)
                {
                    m_horizonMeshRenders.Add(render);
                    render.enabled = false;
                }
            }

            UpdateSurfaceFogSettings();
            if (m_startingUnderwater)
            {
                IsUnderwater      = SetupWaterSystems(true, m_startingUnderwater);
                m_underwaterSetup = true;
                m_surfaceSetup    = false;
            }
            else
            {
                m_underwaterSetup = true;
                m_surfaceSetup    = false;
            }
        }