private void IdleOperateEnter() { //operaObject.BoxCollider.IsShake = true; EventHandRayTargetEnter.SendListener(operaObject.FeaturesObject.gameObject, InputHand.HandIndex); ShowLabel(); //显示高亮 // ShowHightLight(false); }
/// <summary> /// 照射物体处理 /// </summary> /// <param name="hit"></param> void OnRayTarget(RaycastHit hit) { EventHandRayTarget.SendListener(hit, InputHand.HandIndex); switch (InputHand.HandStatus) { case MInputHandStatus.Idle: if (hit.collider == null) { OnNoRayTarget(); return; } if (operaObject != null && operaObject.gameObject == hit.collider.gameObject) { return; } if (operaObject != null) { //处理之前的 OnNoRayTarget(); } operaObject = hit.collider.GetComponent <OperaObject>(); EventHandRayTargetEnter.SendListener(operaObject.FeaturesObject.gameObject, InputHand.HandIndex); if (operaObject == null) { return; } ShowLabel(); //显示高亮 ShowHightLight(false); break; case MInputHandStatus.Grip: if (operaObject != null && operaObject.gameObject != hit.collider.gameObject) { return; } HideLabel(); InputHand.HandStatus = MInputHandStatus.Grab; //将该手状态设置为抓取状态 break; case MInputHandStatus.Grab: if (operaObject == null) { InputHand.HandStatus = MInputHandStatus.Idle; return; } ShowHightLight(true); HideLabel(); OperateObject = HandleGrab(operaObject.FeaturesObject.operaType); if (OperateObject != null) { OperateObject.HandStatus = MInputHandStatus.Grabing; EventHandGrabObject.SendListener(OperateObject.GrabObject, InputHand.HandIndex); EventHandGrabObjectKey.SendListener(OperateObject.GrabObject, InputHand.HandIndex); } InputHand.HandStatus = MInputHandStatus.Grabing; break; case MInputHandStatus.Invalid: if (OnInvalid != null) { OnInvalid(OperateObject, InputHand.HandIndex); } break; case MInputHandStatus.Error: if (OnError != null) { OnError(OperateObject, InputHand.HandIndex); } break; case MInputHandStatus.Grabing: //不可操作中,表示正在有物体进行操作,不可进行其他操作 if (OnGrabing != null) { OnGrabing(OperateObject, InputHand.HandIndex); } break; default: break; } }
private void GrabOperateEnter() { ShowHightLight(true); //operaObject.BoxCollider.IsShake = true; EventHandRayTargetEnter.SendListener(operaObject.FeaturesObject.gameObject, InputHand.HandIndex); }