コード例 #1
0
        // JoyTouchManagment
        private void TouchInput(Touch touch, ControllerBase controller)
        {
            switch (touch.phase)
            {
            case TouchPhase.Began:
                if (controller.CheckTouchPosition(touch.position) && !controller.touchDown)
                {
                    controller.touchId = touch.fingerId;
                    controller.UpdatePosition(touch.position);
                }
                break;

            case TouchPhase.Stationary:
            case TouchPhase.Moved:
                if (controller.touchId == touch.fingerId && controller.touchDown)
                {
                    controller.UpdatePosition(touch.position);
                }
                break;

            case TouchPhase.Ended:
            case TouchPhase.Canceled:
                if (controller.touchId == touch.fingerId && controller.touchDown)
                {
                    controller.ControlReset();
                }
                break;
            }
        }
コード例 #2
0
        // JoyMouseManagment
        private void MouseInput(ControllerBase controller)
        {
            if (controller.CheckTouchPosition(Input.mousePosition) && Input.GetMouseButtonDown(0))
            {
                controller.UpdatePosition(Input.mousePosition);
            }

            if (controller.touchDown && Input.GetMouseButton(0))
            {
                controller.UpdatePosition(Input.mousePosition);
            }

            if (Input.GetMouseButtonUp(0) && controller.touchDown)
            {
                controller.ControlReset();
            }
        }
コード例 #3
0
        // JoyTouchManagment
        private void TouchInput( Touch touch, ControllerBase controller )
        {
            switch( touch.phase )
            {
                case TouchPhase.Began:
                    if( controller.CheckTouchPosition( touch.position ) && !controller.touchDown )
                    {
                        controller.touchId = touch.fingerId;
                        controller.UpdatePosition( touch.position );
                    }
                    break;

                case TouchPhase.Stationary:
                case TouchPhase.Moved:
                    if( controller.touchId == touch.fingerId && controller.touchDown )
                    {
                        controller.UpdatePosition( touch.position );
                    }
                    break;

                case TouchPhase.Ended:
                case TouchPhase.Canceled:
                    if( controller.touchId == touch.fingerId && controller.touchDown )
                    {
                        controller.ControlReset();
                    }
                    break;
            }
        }
コード例 #4
0
        // JoyMouseManagment
        private void MouseInput( ControllerBase controller )
        {
            if( controller.CheckTouchPosition( Input.mousePosition ) && Input.GetMouseButtonDown( 0 ) )
                controller.UpdatePosition( Input.mousePosition );

            if( controller.touchDown && Input.GetMouseButton( 0 ) )
                controller.UpdatePosition( Input.mousePosition );

            if( Input.GetMouseButtonUp( 0 ) && controller.touchDown )
                controller.ControlReset();
        }