private void Start() { //EventCameraZoom.AddListener((float lerp) => //{ // Debug.Log("缩放:" + lerp); //}); //EventCameraRotate.AddListener((Vector3 lerp) => //{ // Debug.Log("旋转向量值:" + lerp); //}); //EventHandGrip.AddListener((int handIndex) => //{ // Debug.Log("握拳:" + handIndex); //}); //EventHandIdle.AddListener((int handIndex) => //{ // Debug.Log("释放:" + handIndex); //}); //Test(); //var result = IsContains(1, OperatePlatform.Mouse); //Debug.Log("result:" + result); EventHandGrabObject.AddListener((go, handIndex) => { //Debug.Log("抓取手:" + handIndex + " 物体:" + go); }); //EventHandRayTarget.AddListener((hit, handIndex) => //{ // Debug.Log("手:" + handIndex + " 射线点:" + hit.collider.gameObject); //}); EventHandRayTargetEnter.AddListener(key, (handIndex) => { //Debug.Log("手:" + handIndex + "物体移入:" + key); }); EventHandRayTargetExit.AddListener(key, (handIndex) => { //Debug.Log("手:" + handIndex + "物体移出:" + key); }); EventHandReleaseObject.AddListener((go, handIndex) => { //Debug.Log("释放手:" + handIndex + " 物体:" + go); }); }
void ontest() { gameObject.AddGrabObject(onGrab); gameObject.RemoveGrabObject(onGrab); gameObject.RemoveGrabObjectAll(); gameObject.AddReleaseObject(OnRelease); gameObject.RemoveReleaseObject(OnRelease); gameObject.RemoveReleaseObjectAll(); gameObject.AddRayTargetEnter(OnTargetEnter); gameObject.RemoveRayTargetEnter(OnTargetEnter); gameObject.RemoveRayTargetEnter(); gameObject.AddRayTargetExit(OnTargetExit); gameObject.RemoveRayTargetExit(); gameObject.RemoveRayTargetExit(OnTargetExit); EventHandRay.AddListener(onRay); EventHandRay.RemoveListener(onRay); EventHandRays.AddListener(OnRays); EventHandRays.RemoveListener(OnRays); EventHandStart.AddListener(onstart); EventHandStart.RemoveListener(onstart); EventHandStop.AddListener(onstop); EventHandStop.RemoveListener(onstop); EventHandUIRay.AddListener(onRay); EventHandUIRay.RemoveListener(onRay); EventCameraZoom.AddListener(onzoom); EventCameraZoom.RemoveListener(onzoom); EventCameraRotate.AddListener(onrotate); EventCameraRotate.RemoveListener(onrotate); EventHandGrabObject.AddListener(ongrabobject); EventHandGrabObject.RemoveListener(ongrabobject); EventHandReleaseObject.AddListener(onreleaseobject); EventHandReleaseObject.RemoveListener(onreleaseobject); EventHandGrabObjectKey.AddListener(gameObject, onGrab); EventHandGrabObjectKey.RemoveListener(gameObject, onGrab); EventHandReleaseObjectKey.AddListener(gameObject, OnRelease); EventHandReleaseObjectKey.RemoveListener(gameObject, OnRelease); EventHandRayTarget.AddListener(onraytarget); EventHandRayTarget.RemoveListener(onraytarget); EventHandRayTargetEnter.AddListener(gameObject, OnTargetEnter); EventHandRayTargetEnter.RemoveListener(gameObject, OnTargetEnter); EventHandRayTargetExit.AddListener(gameObject, OnTargetExit); EventHandRayTargetExit.RemoveListener(gameObject, OnTargetExit); EventHandUIRayEnter.AddListener(gameObject, onuienter); EventHandUIRayEnter.RemoveListener(gameObject, onuienter); EventHandUIRayExit.AddListener(gameObject, onuiexit); EventHandUIRayExit.RemoveListener(gameObject, onuiexit); EventHandUIRay.AddListener(onRay); EventHandUIRay.RemoveListener(onRay); }