Example #1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "Rope" && !sticked)
        {
            if (connectedRopeNode)
            {
                lastRopeSystem = connectedRopeNode.GetComponentInParent <RopeSystem>();
            }

            connectedRopeNode = col.GetComponent <RopeNode>();

            if (!connectedRopeNode.GetComponentInParent <RopeSystem>().enable)
            {
                return;
            }

            connectedRopeNode.GetComponent <Rigidbody2D>().mass += rigidBody.mass;
            forceToRope(rigidBody.velocity.x);

            boyTransform.parent   = connectedRopeNode.transform;
            lerpPosition          = 0;
            rigidBody.isKinematic = true;
            sticked = true;
            animator.SetBool("ClimbRope", true);

            if (humanController.pushing)
            {
                humanController.unPushObject();
            }
        }
    }