YACC YACC
YACC YACC
Made with ❤️ for Unity

Search Results for

    Method ShiftUp

    ShiftUp()

    Shifts the gear box up. ShiftUp() will take care about the appropriate checks for you and won't shift your gear up if you are already in the highest gear.

    Declaration
    public IEnumerator ShiftUp()
    Returns
    Type Description
    IEnumerator

    Returns an IEnumerator instance, to be used in conjunction with StartCoroutine from a MonoBehaviour script.

    Examples

    You can shift the gear box up like this:

    using YACC;
    
    public class MyCarEngineController : MonoBehaviour {
        private GearBox gearBox = new(
            new float[] { 2.66f, 1.78f, 1.30f, 1.00f, 0.74f }, // Gear Ratios
            4.10f, // Final drive ratio
            3.23f, // Reverse ratio
            0.5f   // Shift time
        );
    
        void Update() {
            if (Input.GetKeyDown(KeyCode.UpArrow)) {
                StartCoroutine(gearBox.ShiftUp());
            }
        }
    }
    © Deimos Industries Ltd. All rights reserved.