private void Update() { if (this.Remote) { return; } PLAYBACK_STATE pLAYBACK_STATE = PLAYBACK_STATE.STOPPED; if (this.musicTrack != null) { UnityUtil.ERRCHECK(this.musicTrack.getPlaybackState(out pLAYBACK_STATE)); } if (pLAYBACK_STATE != PLAYBACK_STATE.STOPPED) { PlayerSfx.MusicPlaying = true; } else { PlayerSfx.MusicPlaying = false; } if (base.transform.hasChanged) { base.transform.hasChanged = false; ATTRIBUTES_3D attributes = UnityUtil.to3DAttributes(this.SfxPlayer, null); PlayerSfx.Set3DAttributes(this.staminaBreathInstance, attributes); PlayerSfx.Set3DAttributes(this.walkyTalkyInstance, attributes); PlayerSfx.Set3DAttributes(this.musicTrack, attributes); PlayerSfx.Set3DAttributes(this.afterStormInstance, this.SfxPlayer.transform.position.to3DAttributes()); } if (this.afterStormInstance != null && !this.afterStormInstance.isValid()) { this.afterStormInstance = null; } Vector3 vector = (base.GetComponent <Rigidbody>().position - this.prevPosition) / Time.deltaTime; this.prevPosition = base.GetComponent <Rigidbody>().position; Vector3 vector2 = new Vector3(vector.x, 0f, vector.z); this.flatVelocity = vector2.magnitude; if (!this.Buoyancy.InWater) { this.immersed = false; } else if (!this.immersed && !LocalPlayer.FpCharacter.Grounded && LocalPlayer.FpCharacter.IsAboveWaistDeep()) { this.immersed = true; float num = Mathf.Clamp(this.SplashSpeedMaximum - this.SplashSpeedMinimum, 0f, this.SplashSpeedMaximum); float num2 = (this.Buoyancy.LastWaterEnterSpeed - this.SplashSpeedMinimum) / num; if (num2 >= 0f) { FMOD.Studio.EventInstance @event = FMOD_StudioSystem.instance.GetEvent(this.SplashEvent); UnityUtil.ERRCHECK(@event.set3DAttributes(UnityUtil.to3DAttributes(this.SfxPlayer, null))); UnityUtil.ERRCHECK(@event.setParameterValue("speed", Mathf.Clamp01(num2))); UnityUtil.ERRCHECK(@event.start()); UnityUtil.ERRCHECK(@event.release()); } } }
private void Update() { if (this.Remote) { return; } PLAYBACK_STATE playback_STATE = PLAYBACK_STATE.STOPPED; if (this.musicTrack != null) { UnityUtil.ERRCHECK(this.musicTrack.getPlaybackState(out playback_STATE)); } if (playback_STATE != PLAYBACK_STATE.STOPPED) { PlayerSfx.MusicPlaying = true; } else { PlayerSfx.MusicPlaying = false; } if (base.transform.hasChanged) { base.transform.hasChanged = false; ATTRIBUTES_3D attributes = UnityUtil.to3DAttributes(this.SfxPlayer, null); PlayerSfx.Set3DAttributes(this.staminaBreathInstance, attributes); PlayerSfx.Set3DAttributes(this.walkyTalkyInstance, attributes); PlayerSfx.Set3DAttributes(this.musicTrack, attributes); PlayerSfx.Set3DAttributes(this.TurtleShellSledLoopInstance, attributes); ATTRIBUTES_3D attributes2 = this.SfxPlayer.transform.position.to3DAttributes(); PlayerSfx.Set3DAttributes(this.afterStormInstance, attributes2); PlayerSfx.Set3DAttributes(this.onOceanInstance, attributes2); } if (this.afterStormInstance != null && !this.afterStormInstance.isValid()) { this.afterStormInstance = null; } this.sledOnTerrain = base.GetComponent <FirstPersonCharacter>().terrainContact; if (this.sledIsPlaying) { UnityUtil.ERRCHECK(this.TurtleShellSledLoopSpeedParameter.setValue(LocalPlayer.Rigidbody.velocity.sqrMagnitude / 200f)); } if (this.sledIsPlaying && LocalPlayer.FpCharacter.Grounded) { UnityUtil.ERRCHECK(this.TurtleShellSledLoopAirParameter.setValue(0f)); } else if (this.sledIsPlaying && !LocalPlayer.FpCharacter.Grounded) { UnityUtil.ERRCHECK(this.TurtleShellSledLoopAirParameter.setValue(1f)); } if (this.sledIsPlaying && LocalPlayer.FpCharacter.inSnow) { UnityUtil.ERRCHECK(this.TurtleShellSledLoopSnowParameter.setValue(1f)); } else if (this.sledIsPlaying && !LocalPlayer.FpCharacter.inSnow) { UnityUtil.ERRCHECK(this.TurtleShellSledLoopSnowParameter.setValue(0f)); } Vector3 vector = (base.GetComponent <Rigidbody>().position - this.prevPosition) / Time.deltaTime; this.prevPosition = base.GetComponent <Rigidbody>().position; Vector3 vector2 = new Vector3(vector.x, 0f, vector.z); this.flatVelocity = vector2.magnitude; if (!this.Buoyancy.InWater) { this.immersed = false; } else if (!this.immersed && !LocalPlayer.FpCharacter.Grounded && LocalPlayer.FpCharacter.IsAboveWaistDeep()) { this.immersed = true; float num = Mathf.Clamp(this.SplashSpeedMaximum - this.SplashSpeedMinimum, 0f, this.SplashSpeedMaximum); float num2 = (this.Buoyancy.LastWaterEnterSpeed - this.SplashSpeedMinimum) / num; if (num2 >= 0f) { EventInstance @event = FMOD_StudioSystem.instance.GetEvent(this.SplashEvent); UnityUtil.ERRCHECK(@event.set3DAttributes(UnityUtil.to3DAttributes(this.SfxPlayer, null))); UnityUtil.ERRCHECK(@event.setParameterValue("speed", Mathf.Clamp01(num2))); UnityUtil.ERRCHECK(@event.start()); UnityUtil.ERRCHECK(@event.release()); } } if (this.Buoyancy.InWater && this.Buoyancy.IsOcean) { if (this.onOceanInstance == null) { this.onOceanInstance = FMODCommon.PlayOneshot("event:/ambient/water/on_ocean", base.transform); } } else if (this.onOceanInstance != null) { UnityUtil.ERRCHECK(this.onOceanInstance.stop(STOP_MODE.ALLOWFADEOUT)); UnityUtil.ERRCHECK(this.onOceanInstance.release()); this.onOceanInstance = null; } }