private void STOP() { if ((this.flags & 1) == 1) { this.D.Stop(); } if ((this.flags & 2) == 2) { this.F.Stop(); } if ((this.flags & 4) == 4) { this.E.Stop(); } if ((this.flags & 8) == 8) { this.L.Stop(); } if ((this.flags & 16) == 16) { this.K.Stop(); } EngineSoundLoop.Instance instance = this; instance.flags = (ushort)(instance.flags & 65343); }
private void PLAY() { if ((this.flags & 1024) == 1024) { if ((this.flags & 1) == 1) { this.D.Play(); } if ((this.flags & 2) == 2) { this.F.Play(); } if ((this.flags & 4) == 4) { this.E.Play(); } if ((this.flags & 8) == 8) { this.L.Play(); } if ((this.flags & 16) == 16) { this.K.Play(); } } EngineSoundLoop.Instance instance = this; instance.flags = (ushort)(instance.flags | 64); EngineSoundLoop.Instance instance1 = this; instance1.flags = (ushort)(instance1.flags & 65407); }
private void PAUSE() { if ((this.flags & 1) == 1) { this.D.Pause(); } if ((this.flags & 2) == 2) { this.F.Pause(); } if ((this.flags & 4) == 4) { this.E.Pause(); } if ((this.flags & 8) == 8) { this.L.Pause(); } if ((this.flags & 16) == 16) { this.K.Pause(); } EngineSoundLoop.Instance instance = this; instance.flags = (ushort)(instance.flags | 128); EngineSoundLoop.Instance instance1 = this; instance1.flags = (ushort)(instance1.flags & 65471); }
private void OnDestroy() { if (this.instance != null) { EngineSoundLoop.Instance instance = this.instance; this.instance = null; instance.Dispose(true); } }
public EngineSoundLoop.Instance Create(Transform attachTo, Vector3 localPosition) { EngineSoundLoop.Instance instance; if (!attachTo) { throw new MissingReferenceException("attachTo must not be null or destroyed"); } if (this.instances == null) { this.instances = new Dictionary <Transform, EngineSoundLoop.Instance>(); } else if (this.instances.TryGetValue(attachTo, out instance)) { instance.localPosition = localPosition; return(instance); } instance = new EngineSoundLoop.Instance(attachTo, localPosition, this); this.instances[attachTo] = instance; return(instance); }
private bool UPDATE_SHIFTING(ref bool doPitchAdjust, ref bool doVolumeAdjust) { float single; EngineSoundLoop.Gear gear; float single1 = Time.time - this._shiftTime; if (single1 >= this.loop._shiftDuration) { if ((this.flags & 768) == 768) { EngineSoundLoop.Instance instance = this; instance._gear = (byte)(instance._gear + 1); } else if (this._gear > 0) { EngineSoundLoop.Instance instance1 = this; instance1._gear = (byte)(instance1._gear - 1); } EngineSoundLoop.Instance instance2 = this; instance2.flags = (ushort)(instance2.flags & 64767); return(true); } float single2 = single1 / this.loop._shiftDuration; if ((this.flags & 768) != 768) { single = single2; gear = this.loop._shiftDown; } else { single = this._lastPitchFactor * single2; gear = (this._gear != 0 ? this.loop._shiftUp : this.loop._idleShiftUp); } gear.CompareLerp(single, ref this._pitch, ref doPitchAdjust, ref this._volume, ref doVolumeAdjust); return(false); }
public void Update(float speedFactor, float throttle) { int num = this.flags & 1056; if (num == 32) { this._speedFactor = speedFactor; this._throttle = throttle; } else if (num == 1024) { this.UPDATE(speedFactor, throttle); } else { EngineSoundLoop.Instance instance = this; instance.flags = (ushort)(instance.flags | 1024); this.UPDATE(speedFactor, throttle); if ((this.flags & 192) == 64) { this.PLAY(); } } }
public EngineSoundLoop.Instance Create(Transform attachTo, Vector3 localPosition) { EngineSoundLoop.Instance instance; if (!attachTo) { throw new MissingReferenceException("attachTo must not be null or destroyed"); } if (this.instances == null) { this.instances = new Dictionary<Transform, EngineSoundLoop.Instance>(); } else if (this.instances.TryGetValue(attachTo, out instance)) { instance.localPosition = localPosition; return instance; } instance = new EngineSoundLoop.Instance(attachTo, localPosition, this); this.instances[attachTo] = instance; return instance; }
private void UPDATE(float speedFactor, float throttle) { bool flag; bool flag1; bool flag2; byte num; bool flag3; float single; if (throttle == this._throttle) { flag = false; } else { this._throttle = throttle; flag = true; } float single1 = this._pitch; float single2 = this._volume; float single3 = this._speedFactor; bool flag4 = false; bool flag5 = false; bool flag6 = speedFactor != single3; if (flag6) { this._speedFactor = speedFactor; } if ((this.flags & 256) != 256) { flag1 = true; flag2 = false; } else { bool flag7 = this.UPDATE_SHIFTING(ref flag4, ref flag5); flag2 = flag7; flag1 = flag7; } if (flag1) { while (true) { if (flag6 || flag2) { int num1 = this.loop._topGear; this._lastSinerp = EngineSoundLoop.Sinerp(0f, (float)num1, speedFactor); int num2 = (int)this._lastSinerp; if (num2 == this._gear) { flag3 = false; num = (num2 != num1 ? this._gear : (byte)(num1 - 1)); } else if (num2 < this._gear) { if (this._gear <= 0) { flag3 = false; num = this._gear; } else if (this._gear != num1) { flag3 = true; num = (byte)(this._gear - 1); } else { EngineSoundLoop.Instance instance = this; instance._gear = (byte)(instance._gear - 1); flag3 = false; num = this._gear; } } else if (this._gear >= 255 || this._gear >= num1) { flag3 = false; num = this._gear; } else if (this._gear >= num1 - 1) { flag3 = false; num = this._gear; EngineSoundLoop.Instance instance1 = this; instance1._gear = (byte)(instance1._gear + 1); } else { flag3 = true; num = (byte)(this._gear + 1); } } else { flag3 = false; num = (this._gear != this.loop._topGear ? this._gear : (byte)(this._gear - 1)); } float single4 = this._lastSinerp - (float)num; if (single4 == 0f) { single = 0f; } else if (throttle < 0.5f) { single = (throttle > 0f ? single4 * (0.3f + throttle * 0.7f) : single4 * 0.3f); } else { single = single4; } if (!flag3) { break; } if (num <= this._gear) { EngineSoundLoop.Instance instance2 = this; instance2.flags = (ushort)(instance2.flags | 256); } else { EngineSoundLoop.Instance instance3 = this; instance3.flags = (ushort)(instance3.flags | 768); } this._lastPitchFactor = single; this._shiftTime = Time.time; bool flag8 = this.UPDATE_SHIFTING(ref flag4, ref flag5); flag2 = flag8; if (!flag8) { if (flag5 && this._volume != single2) { this.UPDATE_PITCH_AND_OR_THROTTLE_VOLUME(); } else if (flag) { this.UPDATE_THROTTLE_VOLUME(); } if (flag6) { this.UPDATE_PASSING_VOLUME(); } if (flag4 && this._pitch != single1) { this.UPDATE_RATES(); } return; } } if (single != this._lastPitchFactor || flag2) { this._lastPitchFactor = single; this.loop.GearLerp(num, single, ref this._pitch, ref flag4, ref this._volume, ref flag5); } } if (flag5 && this._volume != single2) { this.UPDATE_PITCH_AND_OR_THROTTLE_VOLUME(); } else if (flag) { this.UPDATE_THROTTLE_VOLUME(); } if (flag6) { this.UPDATE_PASSING_VOLUME(); } if (flag4 && this._pitch != single1) { this.UPDATE_RATES(); } }