Пример #1
0
        public void OnPointerUp(PointerEventData eventData)
        {
            handleTransform.position = pointerStartPosition;

            UIVirtualInput.UpdateInput(VIRTUAL_JOYSTICK_HORIZONTAL_VALUE, 0);
            UIVirtualInput.UpdateInput(VIRTUAL_JOYSTICK_VERTICAL_VALUE, 0);
        }
Пример #2
0
        private void UpdateInput(Vector3 pointerDelta, float pointerMovementRange)
        {
            pointerDelta.Normalize();
            pointerDelta *= pointerMovementRange;

            UIVirtualInput.UpdateInput(VIRTUAL_JOYSTICK_HORIZONTAL_VALUE, pointerDelta.x);
            UIVirtualInput.UpdateInput(VIRTUAL_JOYSTICK_VERTICAL_VALUE, pointerDelta.y);
        }
Пример #3
0
 private void UpdateVerticalInput()
 {
     if (endTouchPosition.y > startTouchPosition.y + 200)
     {
         UIVirtualInput.UpdateInput(VERTICAL_SWIPE_INPUT, 1);
     }
     else if (endTouchPosition.y < startTouchPosition.y - 200)
     {
         UIVirtualInput.UpdateInput(VERTICAL_SWIPE_INPUT, -1);
     }
     else
     {
         UIVirtualInput.UpdateInput(VERTICAL_SWIPE_INPUT, 0);
     }
 }
Пример #4
0
 private void UpdateHorizontalInput()
 {
     if (endTouchPosition.x > startTouchPosition.x + 200)
     {
         UIVirtualInput.UpdateInput(HORIZONTAL_SWIPE_INPUT, 1);
     }
     else if (endTouchPosition.x < startTouchPosition.x - 200)
     {
         UIVirtualInput.UpdateInput(HORIZONTAL_SWIPE_INPUT, -1);
     }
     else
     {
         UIVirtualInput.UpdateInput(HORIZONTAL_SWIPE_INPUT, 0);
     }
 }
Пример #5
0
        private void OnTouchInput()
        {
            if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
            {
                startTouchPosition = Input.GetTouch(0).position;
            }
            else if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
            {
                endTouchPosition = Input.GetTouch(0).position;

                UpdateHorizontalInput();
                UpdateVerticalInput();
            }
            else
            {
                UIVirtualInput.UpdateInput(HORIZONTAL_SWIPE_INPUT, 0);
                UIVirtualInput.UpdateInput(VERTICAL_SWIPE_INPUT, 0);
            }
        }
Пример #6
0
        private void OnUnityEditorInput()
        {
            if (Input.GetMouseButtonDown(0))
            {
                startTouchPosition = Input.mousePosition;
            }
            else if (Input.GetMouseButtonUp(0))
            {
                endTouchPosition = Input.mousePosition;

                UpdateHorizontalInput();
                UpdateVerticalInput();
            }
            else
            {
                UIVirtualInput.UpdateInput(HORIZONTAL_SWIPE_INPUT, 0);
                UIVirtualInput.UpdateInput(VERTICAL_SWIPE_INPUT, 0);
            }
        }
Пример #7
0
 public void OnPointerUp(PointerEventData eventData)
 {
     handleTransform.localScale = new Vector3(1f, 1f, 1f);
     UIVirtualInput.UpdateInput(Input(), 0);
 }
Пример #8
0
 public void OnPointerDown(PointerEventData eventData)
 {
     handleTransform.position   = eventData.position;
     handleTransform.localScale = new Vector3(.9f, .9f, .9f);
     UIVirtualInput.UpdateInput(Input(), 1);
 }
Пример #9
0
 private void OnEnable()
 {
     UIVirtualInput.AddInput(Input(), 0);
 }
Пример #10
0
 private void OnEnable()
 {
     UIVirtualInput.AddInput(HORIZONTAL_SWIPE_INPUT);
     UIVirtualInput.AddInput(VERTICAL_SWIPE_INPUT);
 }
Пример #11
0
 private void OnDisable()
 {
     UIVirtualInput.RemoveInput(VIRTUAL_JOYSTICK_HORIZONTAL_VALUE);
     UIVirtualInput.RemoveInput(VIRTUAL_JOYSTICK_VERTICAL_VALUE);
 }
Пример #12
0
 private void OnEnable()
 {
     UIVirtualInput.AddInput(VIRTUAL_JOYSTICK_HORIZONTAL_VALUE, 0);
     UIVirtualInput.AddInput(VIRTUAL_JOYSTICK_VERTICAL_VALUE, 0);
 }