public void QualityChanged(CETO_QUALITY_SETTING newQuality) { this.currentQualitySetting = newQuality; if (Ocean.Instance == null) { return; } WaveSpectrum waveSpectrum = Ocean.Instance.Spectrum as WaveSpectrum; ProjectedGrid projectedGrid = Ocean.Instance.Grid as ProjectedGrid; OceanQualitySettings.OceanSetting oceanSetting = this.CurrentSetting(); if (waveSpectrum != null) { waveSpectrum.fourierSize = oceanSetting.fourierSize; waveSpectrum.disableFoam = !oceanSetting.spectrumFoamOn; } if (projectedGrid != null) { projectedGrid.resolution = oceanSetting.meshResolution; if (oceanSetting.topSideMaterial != null) { projectedGrid.oceanTopSideMat = oceanSetting.topSideMaterial; } if (oceanSetting.underSideMaterial != null) { projectedGrid.oceanUnderSideMat = oceanSetting.underSideMaterial; } } }
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; } } }