internal void Dispose(bool fromPlayer) { if ((this.flags & 0x20) != 0x20) { if ((this.loop != null) && (this.loop.instances != null)) { this.loop.instances.Remove(this.parent); } this.D = this.E = this.F = this.L = (AudioSource)(this.K = null); if (!fromPlayer && (this.player != null)) { try { this.player.instance = null; Object.Destroy(this.player.gameObject); } catch (Exception exception) { Debug.LogError(exception, this.player); } } this.player = null; this.flags = 0x20; } }
internal Instance(Transform parent, Vector3 offset, EngineSoundLoop loop) { this.parent = parent; this.loop = loop; Type[] components = new Type[] { typeof(EngineSoundLoopPlayer) }; GameObject go = new GameObject("_EnginePlayer", components); this.player = go.GetComponent <EngineSoundLoopPlayer>(); this.player.instance = this; Setup(go, ref this.D, ref this.flags, 1, loop._dUpper, 1f); Setup(go, ref this.F, ref this.flags, 2, loop._fMidHigh, 1f); Setup(go, ref this.E, ref this.flags, 4, loop._eMidLow, 1f); Setup(go, ref this.L, ref this.flags, 8, loop._lLower, 1f); Setup(go, ref this.K, ref this.flags, 0x10, loop._kPassing, 0f); this._lastVolumeFactor = this._lastClampedThrottle = this._lastSinerp = this._lastPitchFactor = float.NegativeInfinity; this._lastVolumeFactorClamp = -128; this._masterVolume = 1f; this._pitch = loop._idleShiftUp.lowVolume; this._shiftTime = -3000f; this._speedFactor = this._dVol = this._fVol = this._eVol = this._kVol = this._throttle = 0f; this._gear = 0; Transform transform = go.transform; transform.parent = parent; transform.localPosition = offset; transform.localRotation = Quaternion.identity; }
internal Instance(Transform parent, Vector3 offset, EngineSoundLoop loop) { this.parent = parent; this.loop = loop; GameObject gameObject = new GameObject("_EnginePlayer", new Type[] { typeof(EngineSoundLoopPlayer) }); this.player = gameObject.GetComponent <EngineSoundLoopPlayer>(); this.player.instance = this; EngineSoundLoop.Instance.Setup(gameObject, ref this.D, ref this.flags, 1, loop._dUpper, 1f); EngineSoundLoop.Instance.Setup(gameObject, ref this.F, ref this.flags, 2, loop._fMidHigh, 1f); EngineSoundLoop.Instance.Setup(gameObject, ref this.E, ref this.flags, 4, loop._eMidLow, 1f); EngineSoundLoop.Instance.Setup(gameObject, ref this.L, ref this.flags, 8, loop._lLower, 1f); EngineSoundLoop.Instance.Setup(gameObject, ref this.K, ref this.flags, 16, loop._kPassing, 0f); float single = Single.NegativeInfinity; float single1 = single; this._lastPitchFactor = single; float single2 = single1; single1 = single2; this._lastSinerp = single2; float single3 = single1; single1 = single3; this._lastClampedThrottle = single3; this._lastVolumeFactor = single1; this._lastVolumeFactorClamp = -128; this._masterVolume = 1f; this._pitch = loop._idleShiftUp.lowVolume; this._shiftTime = -3000f; float single4 = 0f; single1 = single4; this._throttle = single4; float single5 = single1; single1 = single5; this._kVol = single5; float single6 = single1; single1 = single6; this._eVol = single6; float single7 = single1; single1 = single7; this._fVol = single7; float single8 = single1; single1 = single8; this._dVol = single8; this._speedFactor = single1; this._gear = 0; Transform transforms = gameObject.transform; transforms.parent = parent; transforms.localPosition = offset; transforms.localRotation = Quaternion.identity; }
internal void Dispose(bool fromPlayer) { if ((this.flags & 32) == 32) { return; } if (this.loop && this.loop.instances != null) { this.loop.instances.Remove(this.parent); } object obj = null; AudioSource audioSource = (AudioSource)obj; this.K = (AudioSource)obj; AudioSource audioSource1 = audioSource; audioSource = audioSource1; this.L = audioSource1; AudioSource audioSource2 = audioSource; audioSource = audioSource2; this.F = audioSource2; AudioSource audioSource3 = audioSource; audioSource = audioSource3; this.E = audioSource3; this.D = audioSource; if (!fromPlayer && this.player) { try { this.player.instance = null; UnityEngine.Object.Destroy(this.player.gameObject); } catch (Exception exception) { Debug.LogError(exception, this.player); } } this.player = null; this.flags = 32; }
internal Instance(Transform parent, Vector3 offset, EngineSoundLoop loop) { this.parent = parent; this.loop = loop; GameObject gameObject = new GameObject("_EnginePlayer", new Type[] { typeof(EngineSoundLoopPlayer) }); this.player = gameObject.GetComponent<EngineSoundLoopPlayer>(); this.player.instance = this; EngineSoundLoop.Instance.Setup(gameObject, ref this.D, ref this.flags, 1, loop._dUpper, 1f); EngineSoundLoop.Instance.Setup(gameObject, ref this.F, ref this.flags, 2, loop._fMidHigh, 1f); EngineSoundLoop.Instance.Setup(gameObject, ref this.E, ref this.flags, 4, loop._eMidLow, 1f); EngineSoundLoop.Instance.Setup(gameObject, ref this.L, ref this.flags, 8, loop._lLower, 1f); EngineSoundLoop.Instance.Setup(gameObject, ref this.K, ref this.flags, 16, loop._kPassing, 0f); float single = Single.NegativeInfinity; float single1 = single; this._lastPitchFactor = single; float single2 = single1; single1 = single2; this._lastSinerp = single2; float single3 = single1; single1 = single3; this._lastClampedThrottle = single3; this._lastVolumeFactor = single1; this._lastVolumeFactorClamp = -128; this._masterVolume = 1f; this._pitch = loop._idleShiftUp.lowVolume; this._shiftTime = -3000f; float single4 = 0f; single1 = single4; this._throttle = single4; float single5 = single1; single1 = single5; this._kVol = single5; float single6 = single1; single1 = single6; this._eVol = single6; float single7 = single1; single1 = single7; this._fVol = single7; float single8 = single1; single1 = single8; this._dVol = single8; this._speedFactor = single1; this._gear = 0; Transform transforms = gameObject.transform; transforms.parent = parent; transforms.localPosition = offset; transforms.localRotation = Quaternion.identity; }