public void AddPointer(Pointer pointer) { if (pointerCache.ContainsKey(pointer)) { return; } var pointerEventData = new RaycastPointerEventDara(eventSystem); pointerCache[pointer] = pointerEventData; }
public override void Process() { foreach (var item in pointerCache) { Pointer pointer = item.Key; RaycastPointerEventDara pointerEventData = item.Value; List <RaycastResult> results = GetRaycastResults(pointer, pointerEventData); Process(pointer, pointerEventData, results); } }
public override void Raycast(PointerEventData eventData, List <RaycastResult> resultAppendList) { if (canvas == null || eventCamera == null) { return; } RaycastPointerEventDara myPointerEventData = eventData as RaycastPointerEventDara; Raycast(canvas, eventCamera, eventData, myPointerEventData.SelectionRay, ref s_RaycastResults); SetNearestRaycast(ref eventData, ref resultAppendList, ref s_RaycastResults); s_RaycastResults.Clear(); }
protected virtual List <RaycastResult> GetRaycastResults(Pointer pointer, RaycastPointerEventDara pointerEventData) { List <RaycastResult> raycasts = new List <RaycastResult>(); if (pointer.Active) { Ray ray = pointer.SelectionRay; pointerEventData.SelectionRay = ray; RaycastResult raycastResult = new RaycastResult(); raycastResult.worldPosition = ray.origin; raycastResult.worldNormal = ray.direction; pointerEventData.pointerCurrentRaycast = raycastResult; eventSystem.RaycastAll(pointerEventData, raycasts); } return(raycasts); }