private void UpdateEngineSoundsStraight()
        {
            int startSoundIndex    = this.startSoundIndex;
            int rPMDataArrayLength = this.RPMDataArrayLength;
            int num3 = 1;

            while (true)
            {
                if (startSoundIndex != rPMDataArrayLength)
                {
                    RPMSoundBehaviour rpmSoundBehaviour = this.RPMSoundBehaviourArray[startSoundIndex];
                    if (!this.IsRPMBelowEndRange(this.EngineRpm, rpmSoundBehaviour) && rpmSoundBehaviour.NeedToStop)
                    {
                        rpmSoundBehaviour.Stop();
                        this.startSoundIndex += num3;
                        startSoundIndex      += num3;
                        continue;
                    }
                    if (this.IsRPMAboveBeginRange(this.EngineRpm, rpmSoundBehaviour))
                    {
                        rpmSoundBehaviour.Play(this.engineVolume);
                        this.endSoundIndex = startSoundIndex;
                        startSoundIndex   += num3;
                        continue;
                    }
                    rpmSoundBehaviour.Stop();
                }
                return;
            }
        }
        private void UpdateCurrentEngineSoundList()
        {
            int  startSoundIndex = this.startSoundIndex;
            int  endSoundIndex   = this.endSoundIndex;
            bool flag            = true;

            for (int i = this.startSoundIndex; i <= this.endSoundIndex; i++)
            {
                RPMSoundBehaviour behaviour = this.RPMSoundBehaviourArray[i];
                if (behaviour.NeedToStop)
                {
                    behaviour.Stop();
                }
                else
                {
                    behaviour.Play(this.engineVolume);
                    endSoundIndex = i;
                    if (flag)
                    {
                        flag            = false;
                        startSoundIndex = i;
                    }
                }
            }
            this.endSoundIndex   = endSoundIndex;
            this.startSoundIndex = startSoundIndex;
        }
        private void UpdateEngineSoundsReverse()
        {
            int endSoundIndex = this.endSoundIndex;
            int num2          = -1;
            int num3          = -1;

            while (true)
            {
                if (endSoundIndex != num2)
                {
                    RPMSoundBehaviour rpmSoundBehaviour = this.RPMSoundBehaviourArray[endSoundIndex];
                    if (!this.IsRPMAboveBeginRange(this.EngineRpm, rpmSoundBehaviour) && rpmSoundBehaviour.NeedToStop)
                    {
                        rpmSoundBehaviour.Stop();
                        this.endSoundIndex += num3;
                        endSoundIndex      += num3;
                        continue;
                    }
                    if (this.IsRPMBelowEndRange(this.EngineRpm, rpmSoundBehaviour))
                    {
                        rpmSoundBehaviour.Play(this.engineVolume);
                        this.startSoundIndex = endSoundIndex;
                        endSoundIndex       += num3;
                        continue;
                    }
                    rpmSoundBehaviour.Stop();
                }
                return;
            }
        }
        private void PlayAppropriateEngineSounds()
        {
            bool flag = false;

            for (int i = 0; i < this.RPMDataArrayLength; i++)
            {
                RPMSoundBehaviour rpmSoundBehaviour = this.RPMSoundBehaviourArray[i];
                if (!this.IsRPMWithinRange(rpmSoundBehaviour, this.EngineRpm))
                {
                    rpmSoundBehaviour.Stop();
                }
                else
                {
                    if (!flag)
                    {
                        flag = true;
                        this.startSoundIndex = i;
                    }
                    rpmSoundBehaviour.Play(this.engineVolume);
                    this.endSoundIndex = i;
                }
            }
        }