private void handleTouch(WTouch touch, Vector3 position, bool start, bool end) { foreach (Camera cam in cams) { if (!cam.enabled) { continue; } Vector3 vpp = cam.ScreenToViewportPoint(position); if (vpp.x < 0f || vpp.x > 1f || vpp.y < 0f || vpp.y > 1f) { continue; } foreach (DiceButton btn in buttons) { if (btn.started) { if (touch != null) { InputManager.Instance.markTouchAsHandled(touch.touch); } else { InputManager.Instance.markClickAsHandled(); } btn.handleTouch(touch, position, start, end); return; } } Ray ray = cam.ScreenPointToRay(position); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000, layer)) { foreach (DiceButton btn in buttons) { if (hit.transform == btn.transform && !btn.started) { if (touch != null) { InputManager.Instance.markTouchAsHandled(touch.touch); } else { InputManager.Instance.markClickAsHandled(); } btn.handleTouch(touch, position, start, end); return; } } } } }
private void handleTouch(WTouch touch, Vector3 position, bool start, bool end) { foreach(Camera cam in cams) { if (!cam.enabled) { continue; } Vector3 vpp = cam.ScreenToViewportPoint(position); if (vpp.x < 0f || vpp.x > 1f || vpp.y < 0f || vpp.y > 1f) { continue; } foreach(DiceButton btn in buttons) { if (btn.started) { if (touch != null) { InputManager.Instance.markTouchAsHandled(touch.touch); } else { InputManager.Instance.markClickAsHandled(); } btn.handleTouch(touch, position, start, end); return; } } Ray ray = cam.ScreenPointToRay(position); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000, layer)) { foreach(DiceButton btn in buttons) { if (hit.transform == btn.transform && !btn.started) { if (touch != null) { InputManager.Instance.markTouchAsHandled(touch.touch); } else { InputManager.Instance.markClickAsHandled(); } btn.handleTouch(touch, position, start, end); return; } } } } }