// Use this for initialization
 private void Start()
 {
     _characterController = GetComponent <CharacterController>();
     _camera = Camera.main;
     _originalCameraPosition = _camera.transform.localPosition;
     _mouseLook.Init(transform, _camera.transform);
     _fovKick.Setup(_camera);
     _headBob.Setup(_camera, _stepInterval);
     _stepCycle   = 0f;
     _nextStep    = _stepCycle / 2f;
     _stamina     = GetComponent <Stamina>();
     _jumping     = false;
     _audioSource = GetComponent <AudioSource>();
     _underWater  = FindObjectOfType <UnderWater>();
     _mana        = FindObjectOfType <Mana>();
 }
 // Use this for initialization
 private void Start()
 {
     _characterController = GetComponent<CharacterController>();
     _camera = Camera.main;
     _originalCameraPosition = _camera.transform.localPosition;
     _mouseLook.Init(transform, _camera.transform);
     _fovKick.Setup(_camera);
     _headBob.Setup(_camera, _stepInterval);
     _stepCycle = 0f;
     _nextStep = _stepCycle / 2f;
     _stamina = GetComponent<Stamina>();
     _jumping = false;
     _audioSource = GetComponent<AudioSource>();
     _underWater = FindObjectOfType<UnderWater>();
     _mana = FindObjectOfType<Mana>();
 }
    void setWater()
    {
        //Set the initial water Color and the initial water fog color
        Color color       = Color.blue;
        float height      = 20f;
        Color color_under = Color.blue;

        GameObject water   = Instantiate(waterTop);
        GameObject water_B = Instantiate(waterBottom);

        water.transform.position   = new Vector3(water.transform.position.x, height, water.transform.position.z);
        water_B.transform.position = new Vector3(water.transform.position.x, height, water.transform.position.z);
        float fog_density  = .03f;
        float water_height = -10f;

        waterTop.GetComponent <MeshRenderer> ().sharedMaterial.SetColor("_Color", color);
        UnderWater under = new UnderWater(color_under, fog_density, water_height);
    }
        private void TriggerChanged()
        {
            if (Ocean.Instance == null)
            {
                return;
            }
            WaveSpectrum  waveSpectrum  = Ocean.Instance.Spectrum as WaveSpectrum;
            UnderWater    underWater    = Ocean.Instance.UnderWater as UnderWater;
            ProjectedGrid projectedGrid = Ocean.Instance.Grid as ProjectedGrid;

            OceanQualitySettings.OceanSetting oceanSetting = this.CurrentSetting();
            if (waveSpectrum != null)
            {
                if (this.m_playerInTrigger)
                {
                    waveSpectrum.foamAmount -= Time.deltaTime * this.whiteCapFadeRate;
                    waveSpectrum.foamAmount  = Mathf.Max(0f, waveSpectrum.foamAmount);
                    if (this.disableSpectrumOnTrigger)
                    {
                        waveSpectrum.disableDisplacements = true;
                        waveSpectrum.disableSlopes        = true;
                        if (waveSpectrum.foamAmount <= 0f)
                        {
                            waveSpectrum.disableFoam = true;
                        }
                    }
                }
                else
                {
                    waveSpectrum.foamAmount          += Time.deltaTime * this.whiteCapFadeRate;
                    waveSpectrum.foamAmount           = Mathf.Min(this.whiteCapAmount, waveSpectrum.foamAmount);
                    waveSpectrum.disableDisplacements = false;
                    waveSpectrum.disableSlopes        = false;
                    waveSpectrum.disableFoam          = !oceanSetting.spectrumFoamOn;
                }
            }
            if (underWater != null)
            {
                if (this.m_playerInTrigger)
                {
                    if (this.disableUnderWaterOnTrigger)
                    {
                        underWater.enabled = false;
                    }
                }
                else
                {
                    underWater.enabled = true;
                }
            }
            if (projectedGrid != null)
            {
                if (this.m_playerInTrigger)
                {
                    projectedGrid.resolution = this.meshResolutionOnTrigger;
                }
                else
                {
                    projectedGrid.resolution = oceanSetting.meshResolution;
                }
            }
        }