private void FireTapEvent() { Debug.Log("Tap!, " + gesture_time); if (OnTap != null) { Ray r = Camera.main.ScreenPointToRay(start_pos); RaycastHit hit = new RaycastHit(); GameObject hitObj = null; if (Physics.Raycast(r, out hit, Mathf.Infinity)) { hitObj = hit.collider.gameObject; } TapEventArgs args = new TapEventArgs(start_pos, hitObj); OnTap(this, args); if (hitObj != null) { ITapped tapped = hitObj.GetComponent <ITapped>(); if (tapped != null) { tapped.OnTap(); } } } }
private void FireTapEvent(Vector2 pos) { GameObject hitObj = GetHit(pos); //Debug.Log("Tap"); if (OnTap != null) { OnTapEventArg tapArgs = new OnTapEventArg(pos, hitObj); OnTap(this, tapArgs); } if (hitObj != null) { ITapped handler = hitObj.GetComponent <ITapped>(); if (handler != null) { handler.OnTap(); } } }