예제 #1
0
    private static HandleTouchInfoDelegate TouchAreaHandlerWithEvents(OverlapPointDelegate overlapPoint, HandleTouchEventDelegate handler, Camera camera = null)
    {
        return(touch =>
        {
            bool overlap = overlapPoint(touch.WorldPosition(camera));
            bool overlapLastFrame = overlapPoint(touch.LastWorldPosition(camera));

            if (overlap && overlapLastFrame)
            {
                handler(touch, ETouchEventType.IN);
            }
            if (overlap && !overlapLastFrame)
            {
                handler(touch, ETouchEventType.ENTER);
            }
            if (!overlap && overlapLastFrame)
            {
                handler(touch, ETouchEventType.EXIT);
            }
        });
    }
예제 #2
0
 public void ListenForTouchesOnOverlapWithEvents(OverlapPointDelegate overlapPoint, HandleTouchEventDelegate handler, Camera camera = null)
 {
     ListenForTouches(TouchAreaHandlerWithEvents(overlapPoint, handler, camera));
 }