示例#1
0
    private void FixedUpdate()
    {
        if (!GameManager.instance.isRunning)
        {
            return;
        }
        // pass the input to the car!


#if !MOBILE_INPUT
        float h = pInput.GetAxis(Globals.Axis_X1);
        float fwd = pInput.GetAxis(Globals.Axis_Z2);
        float back, boost, drift, handbrake;

        switch (mappingStyle)
        {
        case Mapping.Classic:
            back  = pInput.GetAxis(Globals.Axis_Z1);
            drift = (pInput.GetButton(Globals.BtnAction5) /* || pInput.GetButton(Globals.BtnAction3)*/) ? 1f : 0f;
            //Debug.Log("back and deift: " + back + " - " + drift);
            break;

        case Mapping.AnalogDrift:
            back  = pInput.GetButton(Globals.BtnAction3) ? 1 : 0;
            drift = -pInput.GetAxis(Globals.Axis_Z1);
            break;

        default: goto case Mapping.Classic;
        }

        handbrake = pInput.GetButton(Globals.BtnAction2) ? 1 : 0;
        boost     = pInput.GetButton(Globals.BtnAction1) ? 1 : 0;

        ((ArcadeCarController)car).ActionTimers(pInput.GetButtonTimePressed(Globals.BtnAction1));

        car.Action(back, handbrake, boost, drift);
        car.Move(h, fwd);
#else
        car.Move(h, v, v, 0f);
#endif
    }