private void UpdateEngineSound() { float pitch = pitchForRpm.Evaluate(relativeRpm); float volume = volumeForThrottle.Evaluate(vehicleInput.GetThrottle()); engineAudioSource.pitch = pitch * maxPitch; engineAudioSource.volume = volume * maxVolume; }
private void Update() { float torque = GetTorque() * vehicleInput.GetThrottle(); if (transmission.GetDrive() == Transmission.Drive.NEUTRAL) { UpdateRpmWithoutTransmission(); } else { rpm = GetRpm(); } transmission.ForwardTorque(torque); carAudio.PlayForRelativeRpm(GetRelativeRpm()); }