예제 #1
0
    private void UpdateEngineSound()
    {
        float pitch  = pitchForRpm.Evaluate(relativeRpm);
        float volume = volumeForThrottle.Evaluate(vehicleInput.GetThrottle());

        engineAudioSource.pitch  = pitch * maxPitch;
        engineAudioSource.volume = volume * maxVolume;
    }
예제 #2
0
    private void Update()
    {
        float torque = GetTorque() * vehicleInput.GetThrottle();

        if (transmission.GetDrive() == Transmission.Drive.NEUTRAL)
        {
            UpdateRpmWithoutTransmission();
        }
        else
        {
            rpm = GetRpm();
        }

        transmission.ForwardTorque(torque);
        carAudio.PlayForRelativeRpm(GetRelativeRpm());
    }