示例#1
0
    void ProcessTouchInputs()
    {
        //If this isn't a mobile platform AND we aren't testing in editor, exit
        if (!Application.isMobilePlatform && !testTouchControlsInEditor)
        {
            return;
        }

        Vector2 thumbstickInput = thumbstick.GetDirection();

        //Accumulate horizontal input
        horizontal += thumbstickInput.x;

        //Accumulate jump button input
        jumpPressed = jumpPressed || jumpButton.GetButtonDown();
        jumpHeld    = jumpHeld || jumpButton.GetButton();

        //Using thumbstick, accumulate crouch input
        bool dPadCrouch = thumbstickInput.y <= -verticalDPadThreshold;

        crouchPressed = crouchPressed || (dPadCrouch && !dPadCrouchPrev);
        crouchHeld    = crouchHeld || dPadCrouch;

        //Record whether or not playing is crouching this frame (used for determining
        //if button is pressed for first time or held
        dPadCrouchPrev = dPadCrouch;
    }
示例#2
0
    void ProcessTouchInputs()
    {
        //If this isn't a mobile platform AND we aren't testing in editor, exit
        //これがモバイルプラットフォームではなく、エディターでテストしていない場合は、終了します
        if (!Application.isMobilePlatform && !testTouchControlsInEditor)
        {
            return;
        }

        //Record inputs from screen thumbstick
        //画面のサムスティックからの入力を記録します
        Vector2 thumbstickInput = thumbstick.GetDirection();

        //Accumulate horizontal input
        //水平入力を累積します
        horizontal += thumbstickInput.x;

        //Accumulate jump button input
        //ジャンプボタン入力を累積する
        jumpPressed = jumpPressed || jumpButton.GetButtonDown();
        jumpHeld    = jumpHeld || jumpButton.GetButton();

        //Using thumbstick, accumulate crouch input
        //サムスティックを使用して、しゃがみ入力を蓄積します
        bool dPadCrouch = thumbstickInput.y <= -verticalDPadThreshold;

        crouchPressed = crouchPressed || (dPadCrouch && !dPadCrouchPrev);
        crouchHeld    = crouchHeld || dPadCrouch;

        //Record whether or not playing is crouching this frame (used for determining
        //if button is pressed for first time or held
        //再生がこのフレームをしゃがんでいるかどうかを記録します(決定に使用されます
        //ボタンが初めて押された場合、または保持された場合
        dPadCrouchPrev = dPadCrouch;
    }