protected void init(Hi5_Glove_Interaction_Hand hand) { mJudgeMent = new Hi5_Object_JudgeMent(); mDecision = new Hi5_Glove_Decision(mJudgeMent, hand, this); Hi5_Glove_State_Pinch pinchState = new Hi5_Glove_State_Pinch(); pinchState.Init(hand, this, mDecision); Hi5_Glove_State_Release releaseState = new Hi5_Glove_State_Release(); releaseState.Init(hand, this, mDecision); Hi5_Glove_State_Pinch2 pinch2 = new Hi5_Glove_State_Pinch2(); pinch2.Init(hand, this, mDecision); Hi5_Glove_State_Clap clap = new Hi5_Glove_State_Clap(); clap.Init(hand, this, mDecision); Hi5_Glove_State_Lift Lift = new Hi5_Glove_State_Lift(); Lift.Init(hand, this, mDecision); mDicState.Add(E_Hand_State.EClap, clap); mDicState.Add(E_Hand_State.ELift, Lift); mDicState.Add(E_Hand_State.EPinch, pinchState); mDicState.Add(E_Hand_State.ERelease, releaseState); mDicState.Add(E_Hand_State.EPinch2, pinch2); mCurrentState = releaseState; mJudgeMent.mStateManager = this; mJudgeMent.Hand = hand; }
internal bool IsClap() { if (mHand.gameObject.GetComponent <Hi5_Glove_Property>() != null) { if (!mHand.gameObject.GetComponent <Hi5_Glove_Property>().Property_Data.IsClap) { return(false); } } int objectId = 0; Hi5_Glove_Interaction_Finger_Type fingTypeOne; Hi5_Glove_Interaction_Finger_Type fingTypeTwo; bool isClap = mHand.mState.mJudgeMent.IsClap(out objectId, out fingTypeOne, out fingTypeTwo); Hi5_Glove_Interaction_Item item = Hi5_Interaction_Object_Manager.GetObjectManager().GetItemById(objectId); if (item != null && (item.state == E_Object_State.EStatic || item.state == E_Object_State.EPoke)) { Hi5_Object_State_Clap clapState = item.mstatemanager.GetState(E_Object_State.EClap) as Hi5_Object_State_Clap; clapState.fingerTypeOne = fingTypeOne; clapState.fingerTypeTwo = fingTypeTwo; clapState.hand = mHand; if (mHand.m_IsLeftHand) { clapState.handType = Hi5_Object_State_Clap.Hi5_Object_Clap_Type.ELeft; } else { clapState.handType = Hi5_Object_State_Clap.Hi5_Object_Clap_Type.ERight; } Hi5_Glove_Interaction_Hand handTemp = mHand; item.mstatemanager.ChangeState(E_Object_State.EClap); Hi5_Glove_State_Clap handState = null; mState.GetGloveState <Hi5_Glove_State_Clap> (E_Hand_State.EClap, out handState); if (handState != null) { handState.objectId = objectId; } mState.ChangeState(E_Hand_State.EClap); { Hi5_Glove_Interaction_Object_Event_Data data = Hi5_Glove_Interaction_Object_Event_Data.Instance(item.idObject, item.mObjectType, handTemp.m_IsLeftHand? EHandType.EHandLeft: EHandType.EHandRight, EEventObjectType.EClap); Hi5InteractionManager.Instance.GetMessage().DispenseMessage(Hi5_Glove_Interaction_Message.Hi5_MessageMessageKey.messageObjectEvent, (object)data, null); } { Hi5_Glove_Interaction_Hand_Event_Data data = Hi5_Glove_Interaction_Hand_Event_Data.Instance(item.idObject, handTemp.m_IsLeftHand ? EHandType.EHandLeft : EHandType.EHandRight, EEventHandType.EClap); Hi5InteractionManager.Instance.GetMessage().DispenseMessage(Hi5_Glove_Interaction_Message.Hi5_MessageMessageKey.messageHandEvent, (object)data, null); } return(true); } return(false); }