本文整理汇总了C#中Part.decouple方法的典型用法代码示例。如果您正苦于以下问题:C# Part.decouple方法的具体用法?C# Part.decouple怎么用?C# Part.decouple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part.decouple方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecoupleFromAll
public static void DecoupleFromAll(Part p)
{
SendKISMessage(p, MessageAction.Decouple);
if (p.parent)
{
p.decouple();
//name container if needed
ModuleKISInventory inv = p.GetComponent<ModuleKISInventory>();
if (inv)
{
if (inv.invName != "")
{
p.vessel.vesselName = inv.part.partInfo.title + " | " + inv.invName;
}
else
{
p.vessel.vesselName = inv.part.partInfo.title;
}
}
}
if (p.children.Count != 0)
{
DecoupleAllChilds(p);
}
}
示例2: OnMouseDetachPartClick
void OnMouseDetachPartClick(Part part)
{
if (KISAddonPointer.isRunning) return;
if (hoverInventoryGui()) return;
if (!HighLogic.LoadedSceneIsFlight) return;
if (!detachOk) return;
if (!HasActivePickupInRange(part)) return;
detachActive = false;
KISAddonCursor.StopPartDetection();
KISAddonCursor.CursorDefault();
ModuleKISItem item = part.GetComponent<ModuleKISItem>();
if (item)
{
if (item.staticAttached)
{
item.GroundDetach();
if (item.allowPartAttach == 1)
{
ModuleKISPickup pickupModule = GetActivePickupNearest(part);
KIS_Shared.PlaySoundAtPoint(pickupModule.detachStaticSndPath, pickupModule.part.transform.position);
}
if (item.allowPartAttach == 2)
{
ModuleKISPickup pickupModule = GetActivePickupNearest(part, canStaticAttachOnly: true);
KIS_Shared.PlaySoundAtPoint(pickupModule.detachStaticSndPath, pickupModule.part.transform.position);
}
return;
}
}
part.decouple();
if (item)
{
if (item.allowPartAttach == 1)
{
ModuleKISPickup pickupModule = GetActivePickupNearest(part);
KIS_Shared.PlaySoundAtPoint(pickupModule.detachPartSndPath, pickupModule.part.transform.position);
}
if (item.allowPartAttach == 2)
{
ModuleKISPickup pickupModule = GetActivePickupNearest(part, canPartAttachOnly: true);
KIS_Shared.PlaySoundAtPoint(pickupModule.detachPartSndPath, pickupModule.part.transform.position);
}
}
else
{
ModuleKISPickup pickupModule = GetActivePickupNearest(part, canPartAttachOnly: true);
KIS_Shared.PlaySoundAtPoint(pickupModule.detachPartSndPath, pickupModule.part.transform.position);
}
}
示例3: DecoupleFromAll
public static void DecoupleFromAll(Part p)
{
if (p.parent)
{
p.decouple();
}
if (p.children.Count != 0)
{
KAS_Shared.DecoupleAllChilds(p);
}
}
示例4: OnMouseDetachPartClick
void OnMouseDetachPartClick(Part part)
{
if (KISAddonPointer.isRunning
|| hoverInventoryGui()
|| !HighLogic.LoadedSceneIsFlight
|| !detachOk
|| !HasActivePickupInRange(part)) {
return;
}
detachActive = false;
KISAddonCursor.StopPartDetection();
KISAddonCursor.CursorDefault();
// Get actor's pickup module. Not having one is very suspicious but not a blocker.
var pickupModule = FlightGlobals.ActiveVessel.GetComponent<ModuleKISPickup>();
if (!pickupModule) {
Logger.logError("Unexpected actor executed KIS action via UI: {0}",
FlightGlobals.ActiveVessel);
}
// Deatch part and play detach sound if one available.
ModuleKISItem item = part.GetComponent<ModuleKISItem>();
if (item && item.staticAttached) {
item.GroundDetach(); // Parts attached to the ground need special attention.
} else {
part.decouple(); // Regular parts detach via regular methods.
}
if (pickupModule) {
KIS_Shared.PlaySoundAtPoint(
pickupModule.detachStaticSndPath, pickupModule.part.transform.position);
}
}