private void MoveAttach(Part tgtPart, Vector3 pos, Quaternion rot, string srcAttachNodeID = null, AttachNode tgtAttachNode = null) { KIS_Shared.DebugLog("Move part & attach"); KIS_Shared.SendKISMessage(movingPart, KIS_Shared.MessageAction.AttachStart, KISAddonPointer.GetCurrentAttachNode(), tgtPart, tgtAttachNode); KIS_Shared.DecoupleFromAll(movingPart); movingPart.transform.position = pos; movingPart.transform.rotation = rot; ModuleKISItem moduleItem = movingPart.GetComponent <ModuleKISItem>(); bool useExternalPartAttach = false; if (moduleItem) { if (moduleItem.useExternalPartAttach) { useExternalPartAttach = true; } } if (tgtPart && !useExternalPartAttach) { KIS_Shared.CouplePart(movingPart, tgtPart, srcAttachNodeID, tgtAttachNode); } KIS_Shared.SendKISMessage(movingPart, KIS_Shared.MessageAction.AttachEnd, KISAddonPointer.GetCurrentAttachNode(), tgtPart, tgtAttachNode); KISAddonPointer.StopPointer(); movingPart = null; draggedItem = null; draggedPart = null; }
private void MoveDrop(Part tgtPart, Vector3 pos, Quaternion rot) { KIS_Shared.DebugLog("Move part"); ModuleKISPickup modulePickup = GetActivePickupNearest(pos); if (modulePickup) { if (movingPart.parent) { bool movingPartMounted = false; ModuleKISPartMount partM = movingPart.parent.GetComponent <ModuleKISPartMount>(); if (partM) { if (partM.PartIsMounted(movingPart)) { movingPartMounted = true; } } if (!movingPartMounted) { AudioSource.PlayClipAtPoint(GameDatabase.Instance.GetAudioClip(modulePickup.detachPartSndPath), movingPart.transform.position); } } AudioSource.PlayClipAtPoint(GameDatabase.Instance.GetAudioClip(modulePickup.dropSndPath), pos); } KIS_Shared.DecoupleFromAll(movingPart); movingPart.transform.position = pos; movingPart.transform.rotation = rot; KIS_Shared.SendKISMessage(movingPart, KIS_Shared.MessageAction.DropEnd, KISAddonPointer.GetCurrentAttachNode(), tgtPart); KISAddonPointer.StopPointer(); movingPart = null; }