Example #1
0
    void OnEnable()
    {
        Do(() =>
        {
            for(int i=0; i<Input.touchCount; i++)
            {
                Touch t = new TouchTouch(Input.GetTouch(i));
                if(t.phase == TouchPhase.Began)
                {
                    StartCoroutine(Slide(t));
                }
            }

            if(Input.touchCount == 0 && Input.GetMouseButton(0))
            {
                StartCoroutine(Slide(new TouchMouse()));
            }
            return enabled;
        });
    }
Example #2
0
 Vector3 InputPosition(int fingerId)
 {
     if (fingerId < 0) return Input.mousePosition;
     for(int i=0; i<Input.touchCount; i++)
     {
         Touch t = new TouchTouch(Input.GetTouch(i));
         if (t.fingerId == fingerId)
             return t.position;
     }
     return Vector3.zero;
 }
Example #3
0
    bool GetFinger(int fingerId, out Touch touch)
    {
        if(fingerId < 0)
        {
            touch = new TouchMouse();
            return true;
        }

        for(int i=0; i<Input.touchCount; i++)
        {
            Touch t = new TouchTouch(Input.GetTouch(i));
            if (t.fingerId == fingerId)
            {
                touch = t;
                return true;
            }
        }
        touch = new TouchMouse();
        return false;
    }