/// <summary> /// Gives an item from slot (optional attached to the specified transform). /// </summary> /// <returns>The detached item.</returns> /// <param name="_transform">Transform.</param> /// <param name="_attach">If set to <c>true</c> attach the item to the specified transform.</param> public GameObject GiveItem(Transform _transform, bool _attach) { if (_transform == null) { return(null); } GameObject _item = GiveItem(_transform.position, _transform.rotation); if (_attach) { CreatureRegister.AttachToTransform(_item, _transform); } return(_item); }
/// <summary> /// Attachs to slot. /// </summary> /// <returns><c>true</c>, if to slot was attached, <c>false</c> otherwise.</returns> /// <param name="_object">Object.</param> public bool AttachToSlot(GameObject _object) { if (_object == null) { return(false); } if (!_object.transform.IsChildOf(MountPointTransform)) { return(CreatureRegister.AttachToTransform(_object, MountPointTransform)); } else { return(true); } }