当前位置: 首页>>代码示例>>C#>>正文


C# Part.decouple方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:Amorymeltzer,项目名称:KIS,代码行数:25,代码来源:KIS_Shared.cs

示例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);
            }
        }
开发者ID:khr15714n,项目名称:KIS,代码行数:52,代码来源:KISAddonPickup.cs

示例3: DecoupleFromAll

 public static void DecoupleFromAll(Part p)
 {
     if (p.parent)
     {
         p.decouple();
     }
     if (p.children.Count != 0)
     {
         KAS_Shared.DecoupleAllChilds(p);
     }
 }
开发者ID:ACCBizon,项目名称:KAS,代码行数:11,代码来源:KAS_Shared.cs

示例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);
            }
        }
开发者ID:Kerbas-ad-astra,项目名称:KIS,代码行数:32,代码来源:KISAddonPickup.cs


注:本文中的Part.decouple方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。