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


C# Vessel.Unload方法代码示例

本文整理汇总了C#中Vessel.Unload方法的典型用法代码示例。如果您正苦于以下问题:C# Vessel.Unload方法的具体用法?C# Vessel.Unload怎么用?C# Vessel.Unload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vessel的用法示例。


在下文中一共展示了Vessel.Unload方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HangarCraft

        public static void HangarCraft(Vessel vVessel, StaticObject soHangar, int iMax = 2)
        {
            string sSpace = GetHangarSpace(soHangar, iMax);

            if (sSpace == "None")
            {
                MiscUtils.HUDMessage("This facility is full.", 10,
                    3);
            }
            else
            {
                string sVesselID = vVessel.id.ToString();
                soHangar.setSetting(sSpace, sVesselID);
                PersistenceUtils.saveStaticPersistence(soHangar);

                // Hangar the vessel - hide it
                foreach (Part p in vVessel.Parts)
                {
                    if (p != null && p.gameObject != null)
                        p.gameObject.SetActive(false);
                    else
                        continue;
                }

                vVessel.MakeInactive();
                vVessel.enabled = false;
                vVessel.Unload();
            }
        }
开发者ID:AlphaAsh,项目名称:Kerbal-Konstructs_DEV,代码行数:29,代码来源:HangarGUI.cs

示例2: KillVessel

 private void KillVessel(Vessel killVessel)
 {
     if (killVessel != null)
     {
         //TODO: Deselect the vessel in the tracking station if we are about to kill it.
         DarkLog.Debug("Killing vessel: " + killVessel.id.ToString());
         killVessel.DespawnCrew();
         //Add it to the delay kill list to make sure it dies.
         //With KSP, If it doesn't work first time, keeping doing it until it does.
         if (!delayKillVessels.Contains(killVessel))
         {
             delayKillVessels.Add(killVessel);
         }
         lastKillVesselDestroy[killVessel.id.ToString()] = UnityEngine.Time.realtimeSinceStartup;
         if (killVessel.loaded)
         {
             try
             {
                 killVessel.Unload();
             }
             catch (Exception unloadException)
             {
                 DarkLog.Debug("Error unloading vessel: " + unloadException);
             }
         }
         foreach (ProtoPartSnapshot pps in killVessel.protoVessel.protoPartSnapshots)
         {
             foreach (ProtoCrewMember pcm in pps.protoModuleCrew)
             {
                 DarkLog.Debug("Unassigning " + pcm.name + " from " + killVessel.id.ToString());
                 pcm.rosterStatus = ProtoCrewMember.RosterStatus.Available;
                 pcm.seatIdx = -1;
             }
             pps.protoModuleCrew.Clear();
         }
         try
         {
             killVessel.Die();
         }
         catch (Exception killException)
         {
             DarkLog.Debug("Error destroying vessel: " + killException);
         }
     }
 }
开发者ID:nux17,项目名称:DarkMultiPlayer,代码行数:45,代码来源:VesselWorker.cs

示例3: KillVessel

        public void KillVessel(Vessel killVessel)
        {
            if (killVessel != null)
            {
                DarkLog.Debug("Killing vessel: " + killVessel.id.ToString());

                //Forget the dying vessel
                PartKiller.fetch.ForgetVessel(killVessel);
                HackyInAtmoLoader.fetch.ForgetVessel(killVessel);

                //Try to unload the vessel first.
                if (killVessel.loaded)
                {
                    try
                    {
                        killVessel.Unload();
                    }
                    catch (Exception unloadException)
                    {
                        DarkLog.Debug("Error unloading vessel: " + unloadException);
                    }
                }
                //Remove the kerbal from the craft
                foreach (ProtoPartSnapshot pps in killVessel.protoVessel.protoPartSnapshots)
                {
                    foreach (ProtoCrewMember pcm in pps.protoModuleCrew.ToArray())
                    {
                        pps.RemoveCrew(pcm);
                    }
                }
                //Add it to the delay kill list to make sure it dies.
                //With KSP, If it doesn't work first time, keeping doing it until it does.
                if (!delayKillVessels.Contains(killVessel))
                {
                    delayKillVessels.Add(killVessel);
                }
                lastKillVesselDestroy[killVessel.id] = UnityEngine.Time.realtimeSinceStartup;
                try
                {
                    killVessel.Die();
                }
                catch (Exception killException)
                {
                    DarkLog.Debug("Error destroying vessel: " + killException);
                }
            }
        }
开发者ID:awdAvenger,项目名称:DarkMultiPlayer,代码行数:47,代码来源:VesselWorker.cs

示例4: KillVessel

 private void KillVessel(Vessel killVessel)
 {
     if (killVessel != null)
     {
         bool oldDestroyIsValid = destroyIsValid;
         destroyIsValid = false;
         if (oldDestroyIsValid)
         {
             DarkLog.Debug("Disabling vessel destroy for vessel killing");
         }
         DarkLog.Debug("Killing vessel: " + killVessel.id.ToString());
         try
         {
             if (!killVessel.packed)
             {
                 killVessel.GoOnRails();
             }
             if (killVessel.loaded)
             {
                 killVessel.Unload();
             }
             killVessel.Die();
         }
         catch (Exception e)
         {
             DarkLog.Debug("Error destroying vessel: " + e);
         }
         if (oldDestroyIsValid)
         {
             reenableDestroyInFixedUpdates = 5;
         }
     }
 }
开发者ID:Norgg,项目名称:DarkMultiPlayer,代码行数:33,代码来源:VesselWorker.cs


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