public Raycast ( |
||
eventData | ||
resultAppendList | List |
|
return | void |
public override void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList)
{
if (this.eventCamera != null)
{
Ray ray = this.eventCamera.ScreenPointToRay((Vector3) eventData.position);
float distance = this.eventCamera.farClipPlane - this.eventCamera.nearClipPlane;
RaycastHit2D[] hitdArray = Physics2D.RaycastAll(ray.origin, ray.direction, distance, base.finalEventMask);
if (hitdArray.Length != 0)
{
int index = 0;
int length = hitdArray.Length;
while (index < length)
{
SpriteRenderer component = hitdArray[index].collider.gameObject.GetComponent<SpriteRenderer>();
RaycastResult item = new RaycastResult {
gameObject = hitdArray[index].collider.gameObject,
module = this,
distance = Vector3.Distance(this.eventCamera.transform.position, hitdArray[index].transform.position),
worldPosition = (Vector3) hitdArray[index].point,
worldNormal = (Vector3) hitdArray[index].normal,
screenPosition = eventData.position,
index = resultAppendList.Count,
sortingLayer = (component == null) ? 0 : component.sortingLayerID,
sortingOrder = (component == null) ? 0 : component.sortingOrder
};
resultAppendList.Add(item);
index++;
}
}
}
}
}
static public int Raycast(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.EventSystems.Physics2DRaycaster self = (UnityEngine.EventSystems.Physics2DRaycaster)checkSelf(l); UnityEngine.EventSystems.PointerEventData a1; checkType(l, 2, out a1); System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult> a2; checkType(l, 3, out a2); self.Raycast(a1, a2); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }