상속: SkeletalFinger
예제 #1
0
    void OnTriggerEnter(Collider other)
    {
        // only accept the player get into this trigger
        // and he is ready to go.
//		HHK_Role_Tags rt = other.gameObject.GetComponent<HHK_Role_Tags>();
//		if (rt)
//		{
//			HHK_Role_Tags.TAG[] tags = {HHK_Role_Tags.TAG.Role_Player};
//			if (rt.Is_Belong_Teams(tags)
//			    && HHK_Entry_Points_Manager.ready_to_go)
//			{
//				// player get into this trigger
//				// shift to the next level and start at the given start point/entry point
//				HHK_Entry_Points_Manager.which_start_point = which_start_point;
//				Application.LoadLevel(to_next_level);
//			}
//
//		}
        // leap motion
        RigidFinger finger = other.GetComponentInParent <RigidFinger>();

        if (finger)
        {
            if (HHK_Entry_Points_Manager.ready_to_go)
            {
                HHK_Entry_Points_Manager.which_start_point = which_start_point;
                Application.LoadLevel(to_next_level);
            }
        }
    }
예제 #2
0
    void OnTriggerEnter(Collider other)
    {
        HHK_Role_Tags role = other.GetComponent <HHK_Role_Tags>();

        if (role)
        {
            if (role.Is_Belong_Teams_Either(allowed))
            {
                // in to this area
                roles.Add(role);
            }
        }

        // leap motion
        RigidFinger finger = other.GetComponentInParent <RigidFinger>();

        if (finger)
        {
            //Debug.Log("finger");
            role = other.GetComponentInParent <HHK_Role_Tags>();

            if (role && !roles.Contains(role))
            {
                // in to this area
                roles.Add(role);
            }
        }
    }
예제 #3
0
    void OnTriggerEnter(Collider other)
    {
        // leap motion
        RigidFinger finger = other.GetComponentInParent <RigidFinger>();

        if (finger && !fingers.Contains(finger))
        {
            fingers.Add(finger);
        }
    }
예제 #4
0
    void OnTriggerExit(Collider other)
    {
        // leap motion
        RigidFinger finger = other.GetComponentInParent <RigidFinger>();

        if (finger)
        {
            fingers.Remove(finger);
        }
    }
예제 #5
0
    private void OnTriggerExit(Collider other)
    {
        RigidFinger rf = other.GetComponentInParent <RigidFinger>();

        if (rf && rf.fingerType == Leap.Finger.FingerType.TYPE_THUMB)
        {
            //是否是拇指
            canGrab = false;
        }
    }
예제 #6
0
    void OnTriggerEnter(Collider other)
    {
        // leap motion
        RigidFinger finger = other.GetComponentInParent <RigidFinger>();

        if (finger)
        {
            // call the button onclick event
            bt.onClick.Invoke();
        }
    }
예제 #7
0
    // active the UI
    void OnTriggerEnter(Collider other)
    {
        // leap motion
        RigidFinger finger = other.GetComponentInParent <RigidFinger>();

        if (finger)
        {
            uiPanel.gameObject.SetActive(true);
            backOnLine = false;
        }
    }
    new protected HandModel CreateHand(HandModel model)
    {
        HandModel hand_model = Instantiate(model, transform.position, transform.rotation)
                               as HandModel;

        hand_model.gameObject.SetActive(true);

        ParticleSystem[] particleSystems = hand_model.GetComponentsInChildren <ParticleSystem>();
        foreach (ParticleSystem system in particleSystems)
        {
            system.Stop();
        }

        Utils.IgnoreCollisions(hand_model.gameObject, gameObject);

        // add scripts...
        foreach (FingerModel finger in hand_model.fingers)
        {
            if (finger.GetType() == typeof(RigidFinger))
            {
                RigidFinger rigidFinger = finger as RigidFinger;
                foreach (Transform bone in rigidFinger.bones)
                {
                    if (bone == null)
                    {
                        continue;
                    }
                    GameObject bGameObject = bone.gameObject;
                    Rigidbody  bRigidBody  = bGameObject.gameObject.GetComponent <Rigidbody>() as Rigidbody;
                    bRigidBody.isKinematic            = false;
                    bRigidBody.useGravity             = false;
                    bRigidBody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
                }

                rigidFinger.bones[rigidFinger.bones.Length - 1].gameObject.tag = "FingerTip";
            }
        }



        Collider[] allCls = hand_model.GetComponentsInChildren <Collider>();
        foreach (Collider lcl in allCls)
        {
            foreach (Collider refCl in allCls)
            {
                if (!lcl.Equals(refCl))
                {
                    //Physics.IgnoreCollision(lcl, refCl, true);
                }
            }
        }

        return(hand_model);
    }
예제 #9
0
    private void OnTriggerEnter(Collider other)
    {
        RigidFinger rf = other.GetComponentInParent <RigidFinger>();

        handGrabController = other.GetComponentInParent <RigidHand>().GetComponentInChildren <HandGrabController>();
        if (rf && rf.fingerType == Leap.Finger.FingerType.TYPE_THUMB)
        {
            //是否是拇指
            thumbTip = rf.bones[3];
            canGrab  = true;
        }
        if (!canGrab)
        {
            GetComponent <HandTouchForce>().AddForceForHand(handGrabController.handVelocity);
        }
    }
    new protected HandModel CreateHand(HandModel model)
    {
        HandModel hand_model = Instantiate(model, transform.position, transform.rotation)
                               as HandModel;

        hand_model.gameObject.SetActive(true);

        ParticleSystem[] particleSystems = hand_model.GetComponentsInChildren <ParticleSystem>();
        foreach (ParticleSystem system in particleSystems)
        {
            system.Stop();
        }

        Utils.IgnoreCollisions(hand_model.gameObject, gameObject);

        // add scripts...
        foreach (FingerModel finger in hand_model.fingers)
        {
            if (finger.GetType() == typeof(RigidFinger))
            {
                RigidFinger rigidFinger = finger as RigidFinger;
                foreach (Transform bone in rigidFinger.bones)
                {
                    if (bone == null)
                    {
                        continue;
                    }
                    GameObject bGameObject = bone.gameObject;
                    Rigidbody  bRigidBody  = bGameObject.gameObject.GetComponent <Rigidbody>() as Rigidbody;
                    bRigidBody.isKinematic            = false;
                    bRigidBody.useGravity             = false;
                    bRigidBody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
                }

                rigidFinger.bones[rigidFinger.bones.Length - 1].gameObject.tag = "FingerTip";
            }
        }

        // add grasp script
        if (hand_model.GetType() == typeof(RigidHand))
        {
            hand_model.gameObject.AddComponent <GraspController>();
            GraspController graspController = hand_model.gameObject.GetComponent <GraspController>();
            //graspController.GraspTriggerDistance = 1.0f * this.GraspDistanceScale;
            //graspController.ReleaseTriggerDistance = 2.5f * this.GraspDistanceScale;
            graspController.GraspObjectDistance = 3.5f * this.GraspDistanceScale * transform.localScale.x;
        }

        Collider[] allCls = hand_model.GetComponentsInChildren <Collider>();
        foreach (Collider lcl in allCls)
        {
            foreach (Collider refCl in allCls)
            {
                if (!lcl.Equals(refCl))
                {
                    Physics.IgnoreCollision(lcl, refCl, true);
                }
            }
        }

        if (this.enableFingerParticleSystems && hand_model.GetType() == typeof(SkeletalHand))
        {
            SkeletalHand skeletalHand = hand_model as SkeletalHand;
            foreach (FingerModel finger in skeletalHand.fingers)
            {
                if (finger.GetType() == typeof(SkeletalFinger))
                {
                    SkeletalFinger skeletalFinger = finger as SkeletalFinger;

                    if (skeletalFinger.fingerType == Finger.FingerType.TYPE_INDEX)
                    {
                        Transform bone = skeletalFinger.bones[skeletalFinger.bones.Length - 1];

                        /*GameObject indexProxy = GameObject.Instantiate(this.IndexStimulationProxyPrefab, Vector3.zero, Quaternion.identity) as GameObject;
                         * indexProxy.transform.parent = bone;
                         * indexProxy.transform.localPosition = Vector3.zero;*/
                    }
                    else if (skeletalFinger.fingerType == Finger.FingerType.TYPE_THUMB)
                    {
                        Transform bone = skeletalFinger.bones[skeletalFinger.bones.Length - 1];

                        /*GameObject thumbProxy = GameObject.Instantiate(this.ThumbStimulationProxyPrefab, Vector3.zero, Quaternion.identity) as GameObject;
                         * thumbProxy.transform.parent = bone;
                         * thumbProxy.transform.localPosition = Vector3.zero;*/
                    }
                }
            }
            //skeletalHand.gameObject.AddComponent<StimulationProxy>();
        }

        return(hand_model);
    }