List <GestureHit> innerCastAll(Ray targetRay, LayerMask RaycastLayerMask) { List <GestureHit> hitBehaviours = new List <GestureHit>(); RaycastHit[] innerHits = Physics.RaycastAll(targetRay, Mathf.Infinity, RaycastLayerMask); foreach (RaycastHit innerHit in innerHits) { GestureHit h = new GestureHit(); h.HitHandlers = GetComponentsByInterfaceType <IGestureHandler>(innerHit.transform); h.Hit = innerHit; hitBehaviours.Add(h); } return(hitBehaviours); }
List <GestureHit> innerCast(Ray targetRay, LayerMask RaycastLayerMask) { List <GestureHit> hitBehaviours = new List <GestureHit>(); RaycastHit innerHit = new RaycastHit(); if (Physics.Raycast(targetRay, out innerHit, Mathf.Infinity, RaycastLayerMask)) { GestureHit h = new GestureHit(); h.HitHandlers = GetComponentsByInterfaceType <IGestureHandler>(innerHit.collider.transform); h.Hit = innerHit; hitBehaviours.Add(h); } return(hitBehaviours); }
List <GestureHit> innerCastGUI(Vector3 screenPos, Camera castOn, GUILayer gui) { List <GestureHit> hitBehaviours = new List <GestureHit>(); GUIElement g = gui.HitTest(screenPos); if (g == null) { return(null); } GestureHit h = new GestureHit(); h.HitHandlers = GetComponentsByInterfaceType <IGestureHandler>(g.transform); h.Hit = new RaycastHit(); hitBehaviours.Add(h); return(hitBehaviours); }