Beispiel #1
0
 public void StopListenForStationary(HandleTouchInfoDelegate handler)
 {
     HandleStationary -= handler;
 }
Beispiel #2
0
 public void ListenForEnd(HandleTouchInfoDelegate handler)
 {
     HandleEnd += handler;
 }
Beispiel #3
0
 public void StopListenForEnd(HandleTouchInfoDelegate handler)
 {
     HandleEnd -= handler;
 }
Beispiel #4
0
 public void StopListenForMove(HandleTouchInfoDelegate handler)
 {
     HandleMove -= handler;
 }
Beispiel #5
0
    public void ListenForMultiTapsOnCollider(OverlapPointDelegate overlapPoint, int tapCount, float maxTime, HandleTouchInfoDelegate handler)
    {
        int count = 0;

        TouchInfo[] taps = new TouchInfo[tapCount];

        ListenForTouches(TouchAreaHandlerSimple(overlapPoint, (touch) =>
        {
            while (touch.m_startTime - taps[0].m_startTime > maxTime)
            {
                for (int i = 1; i < count; i++)
                {
                    taps[i - 1] = taps[i];
                }
            }

            if (count < tapCount - 1)
            {
                taps[count] = touch;
                count++;
            }
            else
            {
                count = 0;
                handler(touch);
            }
        }));
    }
Beispiel #6
0
 private static HandleTouchInfoDelegate TouchAreaHandlerSimple(OverlapPointDelegate overlapPoint, HandleTouchInfoDelegate handler, Camera camera = null)
 {
     return(touch =>
     {
         bool overlap = overlapPoint(touch.WorldPosition(camera));
         if (overlap)
         {
             handler(touch);
         }
     });
 }
Beispiel #7
0
 public void ListenForTouchesOnOverlapSimple(OverlapPointDelegate overlapPoint, HandleTouchInfoDelegate handler, Camera camera = null)
 {
     ListenForTouches(TouchAreaHandlerSimple(overlapPoint, handler, camera));
 }
Beispiel #8
0
 public void ListenForTouches(HandleTouchInfoDelegate handler)
 {
     HandleTouches += handler;
 }