public void StopListenForStationary(HandleTouchInfoDelegate handler) { HandleStationary -= handler; }
public void ListenForEnd(HandleTouchInfoDelegate handler) { HandleEnd += handler; }
public void StopListenForEnd(HandleTouchInfoDelegate handler) { HandleEnd -= handler; }
public void StopListenForMove(HandleTouchInfoDelegate handler) { HandleMove -= handler; }
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); } })); }
private static HandleTouchInfoDelegate TouchAreaHandlerSimple(OverlapPointDelegate overlapPoint, HandleTouchInfoDelegate handler, Camera camera = null) { return(touch => { bool overlap = overlapPoint(touch.WorldPosition(camera)); if (overlap) { handler(touch); } }); }
public void ListenForTouchesOnOverlapSimple(OverlapPointDelegate overlapPoint, HandleTouchInfoDelegate handler, Camera camera = null) { ListenForTouches(TouchAreaHandlerSimple(overlapPoint, handler, camera)); }
public void ListenForTouches(HandleTouchInfoDelegate handler) { HandleTouches += handler; }