Esempio n. 1
0
    //================================================================================

    void Update()
    {
        if (inputSettings.movementInputName == "")
        {
            ErrorHandling.LogError("Warning [FirstPersonView_TranslationalMotionController] : " +
                                   "Please specify the (correct) name of the movement VirtualJoystick.");
        }
        else
        {
            joystickAxis = VirtualJoystick.GetAxis(inputSettings.movementInputName);
            VirtualJoystick.GetAngleAndMagnitude(inputSettings.movementInputName, out joystickAngle, out joystickMagnitude);
        }

        if (inputSettings.runInputName == "")
        {
            ErrorHandling.LogError("Warning [FirstPersonView_TranslationalMotionController] : " +
                                   "Please specify the (correct) name of runInputName in the inspector");
        }
        else
        {
            switch (inputSettings.runInputStyle)
            {
            case RunJumpInputStyle.VirtualJoystick_DoubleTap:
                isRunning = VirtualJoystick.GetDoubleTap(inputSettings.runInputName);
                break;

            case RunJumpInputStyle.VirtualJoystick_DoubleTapHold:
                isRunning = VirtualJoystick.GetDoubleTapHold(inputSettings.runInputName);
                break;

            case RunJumpInputStyle.VirtualTouchpad_DoubleTap:
                isRunning = VirtualTouchpad.GetDoubleTap(inputSettings.runInputName);
                break;

            case RunJumpInputStyle.VirtualTouchpad_DoubleTapHold:
                isRunning = VirtualTouchpad.GetDoubleTapHold(inputSettings.runInputName);
                break;

            case RunJumpInputStyle.VirtualButton_GoingDown:
                isRunning = VirtualButton.GetButtonDown(inputSettings.runInputName);
                break;

            case RunJumpInputStyle.VirtualButton_Down:
                isRunning = VirtualButton.GetButton(inputSettings.runInputName);
                break;

            case RunJumpInputStyle.None:
                isRunning = false;
                break;

            default:
                isRunning = false;
                break;
            }
        }

        if (inputSettings.jumpInputName == "")
        {
            ErrorHandling.LogError("Warning [FirstPersonView_TranslationalMotionController] : " +
                                   "Please specify the (correct) name of jumpInputName in the inspector");
        }
        else
        {
            switch (inputSettings.jumpInputStyle)
            {
            case RunJumpInputStyle.VirtualJoystick_DoubleTap:
                isJumping = VirtualJoystick.GetDoubleTap(inputSettings.jumpInputName);
                break;

            case RunJumpInputStyle.VirtualJoystick_DoubleTapHold:
                isJumping = VirtualJoystick.GetDoubleTapHold(inputSettings.jumpInputName);
                break;

            case RunJumpInputStyle.VirtualTouchpad_DoubleTap:
                isJumping = VirtualTouchpad.GetDoubleTap(inputSettings.jumpInputName);
                break;

            case RunJumpInputStyle.VirtualTouchpad_DoubleTapHold:
                isJumping = VirtualTouchpad.GetDoubleTapHold(inputSettings.jumpInputName);
                break;

            case RunJumpInputStyle.VirtualButton_GoingDown:
                isJumping = VirtualButton.GetButtonDown(inputSettings.jumpInputName);
                break;

            case RunJumpInputStyle.VirtualButton_Down:
                isJumping = VirtualButton.GetButton(inputSettings.jumpInputName);
                break;

            case RunJumpInputStyle.None:
                isJumping = false;
                break;

            default:
                isJumping = false;
                break;
            }
        }
    }     // void Update ()