override public void Start()
 {
     staticStartY   = ObjectItem.transform.position.y;
     staticPosition = ObjectItem.transform.position;
     //ObjectItem.ChangeColor (ObjectItem.orgColor);
     //if (Hi5_Interaction_Const.TestModifyConstraints)
     {
         if (ObjectItem.mObjectType == EObject_Type.ECommon)
         {
             if (ObjectItem.GetComponent <Hi5_Object_Property>() != null &&
                 ObjectItem.GetComponent <Hi5_Object_Property>().ObjectProperty.StaticProperty != null)
             {
                 ObjectItem.SetIsKinematic(false);
                 ObjectItem.SetUseGravity(true);
                 ObjectItem.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None;
                 ObjectItem.GetComponent <Hi5_Object_Property>().SetRotation(ObjectItem.GetComponent <Hi5_Object_Property>().ObjectProperty.StaticProperty.ConstraintsFreezeRotation,
                                                                             ObjectItem.GetComponent <Hi5_Object_Property>().ObjectProperty.StaticProperty.ConstraintsFreezeRotation,
                                                                             ObjectItem.GetComponent <Hi5_Object_Property>().ObjectProperty.StaticProperty.ConstraintsFreezeRotation);
             }
             else
             {
                 ObjectItem.SetIsKinematic(false);
                 ObjectItem.SetUseGravity(true);
                 ObjectItem.CleanLock();
             }
         }
         else
         {
             ObjectItem.SetIsKinematic(true);
         }
     }
 }
예제 #2
0
        public override void Update(float deltaTime)
        {
            if (ObjectItem.mObjectType == EObject_Type.ECommon)
            {
                ObjectItem.SetIsKinematic(true);
                ObjectItem.SetIsLockYPosition(true);
                ObjectItem.SetUseGravity(true);
            }
            else
            {
                ObjectItem.SetIsKinematic(true);
                ObjectItem.SetIsLockYPosition(true);
                ObjectItem.SetUseGravity(true);
            }

            cd -= deltaTime;
            if (IsRealese() && cd < 0.0f)
            {
                ObjectItem.mstatemanager.ChangeState(E_Object_State.EStatic);
                {
                    Hi5_Glove_Interaction_Object_Event_Data data = Hi5_Glove_Interaction_Object_Event_Data.Instance(ObjectItem.idObject,
                                                                                                                    ObjectItem.mObjectType,
                                                                                                                    handType == Hi5_Object_Clap_Type.ELeft ? EHandType.EHandLeft : EHandType.EHandRight,
                                                                                                                    EEventObjectType.EStatic);
                    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(ObjectItem.idObject,
                                                                                                                handType == Hi5_Object_Clap_Type.ELeft ? EHandType.EHandLeft : EHandType.EHandRight,
                                                                                                                EEventHandType.ERelease);
                    Hi5InteractionManager.Instance.GetMessage().DispenseMessage(Hi5_Glove_Interaction_Message.Hi5_MessageMessageKey.messageHandEvent, (object)data, null);
                }
            }
        }
예제 #3
0
        public override void Start()
        {
            //Debug.Log("Hi5_Object_State_Clap start");
            cd = Hi5_Interaction_Const.Clapcd;
            //ObjectItem.ChangeColor (Color.green);

            //if (Hi5_Interaction_Const.TestModifyConstraints)
            {
                ObjectItem.SetIsKinematic(true);
                ObjectItem.SetUseGravity(true);
            }
        }
        override public void Update(float deltaTime)
        {
            if (Hi5_Interaction_Const.TestChangeState1)
            {
                if (ObjectItem.transform.parent != Hi5_Interaction_Object_Manager.GetObjectManager().transform)
                {
                    ///Debug.Log ("static palm parent");
                    ObjectItem.transform.parent = Hi5_Interaction_Object_Manager.GetObjectManager().transform;
                }
            }

            {
                if (ObjectItem.mObjectType == EObject_Type.ECommon)
                {
                    if (((!ObjectItem.IsTouchPlane()) && (!ObjectItem.IsTouchStaticObject())))
                    {
                        //Debug.Log ("Move From");
                        ObjectItem.SetIsKinematic(false);
                        ObjectItem.SetUseGravity(true);
                        ObjectItem.SetIsLockYPosition(false);
                        if (Hi5_Interaction_Const.TestPlaneStatic)
                        {
                            if (!StartY)
                            {
                                StartY = true;
                                Y      = ObjectItem.transform.position.y;
                            }
                            else
                            {
                                if (StartY)
                                {
                                    if (Mathf.Abs(Y - ObjectItem.transform.position.y) > 0.2f)
                                    {
                                        ObjectItem.mstatemanager.GetMoveState().SetFreeMove(null);
                                        ObjectItem.ChangeState(E_Object_State.EMove);
                                        {
                                            Hi5_Glove_Interaction_Object_Event_Data data = Hi5_Glove_Interaction_Object_Event_Data.Instance(ObjectItem.idObject,
                                                                                                                                            ObjectItem.mObjectType,
                                                                                                                                            EHandType.ENone,
                                                                                                                                            EEventObjectType.EMove);
                                            Hi5InteractionManager.Instance.GetMessage().DispenseMessage(Hi5_Glove_Interaction_Message.Hi5_MessageMessageKey.messageObjectEvent, (object)data, null);
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            ObjectItem.mstatemanager.GetMoveState().SetFreeMove(null);
                            ObjectItem.ChangeState(E_Object_State.EMove);
                            {
                                Hi5_Glove_Interaction_Object_Event_Data data = Hi5_Glove_Interaction_Object_Event_Data.Instance(ObjectItem.idObject,
                                                                                                                                ObjectItem.mObjectType,
                                                                                                                                EHandType.ENone,
                                                                                                                                EEventObjectType.EMove);
                                Hi5InteractionManager.Instance.GetMessage().DispenseMessage(Hi5_Glove_Interaction_Message.Hi5_MessageMessageKey.messageObjectEvent, (object)data, null);
                            }
                        }
                    }
                    else
                    {
                        ObjectItem.SetIsKinematic(false);
                        ObjectItem.SetIsLockYPosition(false);
                        ObjectItem.SetUseGravity(true);
                    }
                }
                else
                {
                    ObjectItem.SetIsKinematic(true);
                    ObjectItem.SetIsLockYPosition(true);
                    ObjectItem.SetUseGravity(false);
                    //ObjectItem.transform.position = new Vector3 (ObjectItem.transform.position.x,ObjectItem.Y,ObjectItem.transform.position.z);
                }
            }


            if (ObjectItem.mObjectType == EObject_Type.EButton)
            {
                ObjectItem.SetIsKinematic(true);
                ObjectItem.SetIsLockYPosition(true);
            }
        }