Example #1
0
        private void ShowSpeedometerUI()
        {
            Gear currentGear = gearEngine.GetCurrentGear();

            if (currentGear.GetMaxSpeed() == 0)
            {
                UpdateSpeedometer(gearEngine.GetCurrentRPM(), gearEngine.GetMaxRPM());
            }
            else
            {
                UpdateSpeedometer(gearEngine.GetCurrentSpeed(), gearEngine.GetCurrentMaxSpeed());
            }
        }
Example #2
0
        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);
            }
        }