예제 #1
0
    public void AttachPiece()
    {
        if (_attachedPiece == null)
        {
            return;
        }

        RelativeJoint2D attachedJoint = _attachedPiece.GetComponent <RelativeJoint2D>();

        if (_attachedJoint == attachedJoint)
        {
            //_attachedPiece.Unattach();
            Destroy(_attachedJoint);

            _attachedPiece.gameObject.layer = _vehicleLayer;
            _attachedPiece.AttachToRB(_attachedOverlapping, _playerController);

            _attachedPiece = null;
            _attachedJoint = null;
        }
    }