示例#1
0
    private void OnTriggerEnter(Collider other)
    {
        if (InputKeysManager.Instance.IsFalling || !isExtending || isReturning)
        {
            return;
        }

        GrabbableObject contactObject = other.GetComponent <GrabbableObject>();

        if (contactObject == null)
        {
            return;
        }

        if (contactObject.GetComponent <TreeBranchBehaviour>() != null && contactObject.GetComponent <TreeBranchBehaviour>().IsCurrentBranch)
        {
            return;
        }


        contactObject.UpdateColorUp();

        StopAllCoroutines();
        lockedToObject = true;
        isExtending    = false;
        isExtended     = true;

        graspManager.ChangeGraspObject(other.gameObject, typeOfHand);
        handAnimator.SetBool("inBranch", true);
        particleSystem.Play();


        if (!contactObject.IsStaticObject())
        {
            graspManager.ChangeObjectInHands(contactObject, this.transform);
        }
        else
        {
            myTransform.parent = otherParent;
        }
    }