Beispiel #1
0
    void GrabAndDrag()
    {
        #region Grabbing and Dragging
        // Left Bumper picks up player when held
        if (Input.GetAxisRaw(pickUp) > 0 && !pickUpMode && inRange && !ragdolling)
        {
            pickUpMode     = true;
            draggingPlayer = true;
        }
        else if (Input.GetAxisRaw(pickUp) == 0 && pickUpMode)
        {
            draggingPlayer    = false;
            pickUpScript.join = false;
            Destroy(pickUpScript.GetComponent <SpringJoint>());
            pickUpMode = false;
        }

        // Current Setup for picking up player
        if (pickUpMode && inRange && !pickUpScript.join && ClosestPlayer.GetComponentInParent <PlayerController>().ragdolling)
        {
            pickUpScript.join = false;
            pickUpScript.CreateJoint();
        }
        #endregion
    }