private void ShowSpeedometerUI() { Gear currentGear = gearEngine.GetCurrentGear(); if (currentGear.GetMaxSpeed() == 0) { UpdateSpeedometer(gearEngine.GetCurrentRPM(), gearEngine.GetMaxRPM()); } else { UpdateSpeedometer(gearEngine.GetCurrentSpeed(), gearEngine.GetCurrentMaxSpeed()); } }
IEnumerator PlayEngine() { float t; while (true) { if (gearEngine.GetCurrentGearNumber() == 0) { t = gearEngine.GetCurrentRPM() / gearEngine.GetMaxRPM(); } else { t = gearEngine.GetCurrentSpeed() / gearEngine.GetCurrentMaxSpeed(); } engineSource.pitch = Mathf.Lerp(.8f, 3, t); yield return(null); } }