Esempio n. 1
0
        private void UpdateTouchPosition()
        {
            if (Input.touchCount == 0)
            {
                return;
            }

            var touch         = Input.GetTouch(0);
            var touchPhase    = touch.phase;
            var touchPosition = touch.position;

            if (touchPhase == TouchPhase.Began)
            {
                _touchStartPosition = touchPosition;
                InputStarted.Invoke();
                return;
            }

            if (touchPhase == TouchPhase.Moved)
            {
                OnTouchMove(touchPosition);
                return;
            }

            if (touchPhase == TouchPhase.Ended)
            {
                OnTouchMove(touchPosition);
                InputEnded.Invoke();
            }
        }
 protected void OnMouseButtonUpHandler()
 {
     if (StartedDrag)
     {
         StartedDrag = false;
         InputEnded?.Invoke();
     }
 }
Esempio n. 3
0
        private void UpdateClickPosition()
        {
            if (Input.GetMouseButtonDown(0))
            {
                _touchStartPosition = Input.mousePosition;
                InputStarted.Invoke();
                return;
            }

            if (Input.GetMouseButton(0))
            {
                OnTouchMove(Input.mousePosition);
                return;
            }

            if (Input.GetMouseButtonUp(0))
            {
                OnTouchMove(Input.mousePosition);
                InputEnded.Invoke();
            }
        }