public void Update() { if (this.m_State == MSState.FadeOut && Time.time > this.m_StopTime + this.m_FadeOutTime) { this.Stop(); return; } this.UpdateParams(); this.UpdateSpatialBlend(); float num = 1f; if (this.m_RainForestAmbient) { num = MSMultiSample.s_RainforestWantedAmbientVolume; } else if (this.m_State == MSState.FadeIn) { if (this.m_ChangeRainforestAmbientVolume) { Mathf.Clamp01((Time.time - this.m_PlayTime) / this.m_PlayTime + this.m_FadeInTime); MSMultiSample.s_RainforestWantedAmbientVolume = CJTools.Math.GetProportionalClamp(1f, this.m_RainforestAmbientVolume, Time.time, this.m_PlayTime, this.m_PlayTime + this.m_FadeInTime); } num = CJTools.Math.GetProportionalClamp(this.m_VolumeMulOnStartFade, 1f, Time.time, this.m_PlayTime, this.m_PlayTime + this.m_FadeInTime); if (num >= 1f) { this.m_State = MSState.Playing; } } else if (this.m_State == MSState.FadeOut) { if (this.m_ChangeRainforestAmbientVolume) { Mathf.Clamp01((Time.time - this.m_StopTime) / this.m_StopTime + this.m_FadeInTime); MSMultiSample.s_RainforestWantedAmbientVolume = CJTools.Math.GetProportionalClamp(this.m_RainforestAmbientVolume, 1f, Time.time, this.m_StopTime, this.m_StopTime + this.m_FadeOutTime); } num = CJTools.Math.GetProportionalClamp(this.m_VolumeMulOnStartFade, 0f, Time.time, this.m_StopTime, this.m_StopTime + this.m_FadeOutTime); } else if (this.m_State == MSState.Playing && this.m_ChangeRainforestAmbientVolume) { MSMultiSample.s_RainforestWantedAmbientVolume = this.m_RainforestAmbientVolume; } this.m_VolumeMul = num; for (int i = 0; i < this.m_Samples.Count; i++) { MSSample mssample = this.m_Samples[i]; if (mssample != null) { mssample.Update(num); } } }
public void Update() { if (Time.time > this.m_StopTime + this.m_FadeOutTime) { this.Stop(); return; } this.UpdateParams(); float proportionalClamp = CJTools.Math.GetProportionalClamp(0f, 1f, Time.time, this.m_PlayTime, this.m_PlayTime + this.m_FadeInTime); if (Time.time > this.m_StopTime) { proportionalClamp = CJTools.Math.GetProportionalClamp(1f, 0f, Time.time, this.m_StopTime, this.m_StopTime - this.m_FadeOutTime); } for (int i = 0; i < this.m_Samples.Count; i++) { MSSample mssample = this.m_Samples[i]; if (mssample != null) { mssample.Update(proportionalClamp); } } }