private void CheckTouch(InControl.Touch touch)
 {
     if (touch.phase == TouchPhase.Began)
     {
         this.OnTap.Invoke();
     }
 }
Пример #2
0
        private void OnGUI()
        {
            float num        = 10f;
            int   touchCount = TouchManager.TouchCount;

            for (int i = 0; i < touchCount; i++)
            {
                InControl.Touch touch = TouchManager.GetTouch(i);
                GUI.Label(new Rect(10f, num, 500f, num + 15f), string.Empty + i + ": fingerId = " + touch.fingerId + ", phase = " + touch.phase.ToString() + ", position = " + touch.position);
                num += 20f;
            }
        }
    /// <summary>
    /// Returns a bool representing whether a swipe was detected or not
    /// True if swipe was detected, false otherwise
    /// </summary>
    public bool RecordSwipe()
    {
        if (TouchManager.TouchCount > 0)
        {
            InControl.Touch touch = TouchManager.GetTouch(0);

            //Record starting position of touch
            if (touch.phase == TouchPhase.Began)
            {
                touchStart = touch.position;
            }
            else if (touch.phase == TouchPhase.Ended)
            {
                touchEnd = touch.position;

                //Play box animation
                swipeBox.GetComponent <Animator>().SetTrigger("PulseBox");

                return(true);
            }
        }

        return(false);
    }
Пример #4
0
 public void FreeTouch(Touch touch)
 {
     touch.Reset();
     freeTouches.Add(touch);
 }
Пример #5
0
 public bool Contains(Touch touch)
 {
     return(Contains(TouchManager.ScreenToWorldPoint(touch.position)));
 }