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


C# Vessel.DespawnCrew方法代码示例

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


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

示例1: 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;
         try
         {
             if (killVessel.parts != null)
             {
                 try
                 {
                     for (int partID = killVessel.parts.Count - 1; partID >= 0; partID--)
                     {
                         Part killPart = killVessel.parts[partID];
                         killPart.explosionPotential = 0f;
                         killPart.Die();
                     }
                 }
                 catch (Exception partException)
                 {
                     DarkLog.Debug("Error killing parts: " + partException);
                 }
             }
             killVessel.Die();
         }
         catch (Exception killException)
         {
             DarkLog.Debug("Error destroying vessel: " + killException);
         }
     }
 }
开发者ID:kevin-ye,项目名称:DarkMultiPlayer,代码行数:40,代码来源:VesselWorker.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;
         try
         {
             killVessel.Die();
         }
         catch (Exception killException)
         {
             DarkLog.Debug("Error destroying vessel: " + killException);
         }
     }
 }
开发者ID:martindevans,项目名称:DarkMultiPlayer,代码行数:24,代码来源:VesselWorker.cs

示例3: handleUnloadCrew

 private void handleUnloadCrew(Vessel ves, bool savereturn)
 {
     foreach (Part p in ves.parts)
     {
         if (p.CrewCapacity > 0 && p.protoModuleCrew.Count > 0)
         {
             for (int i = p.protoModuleCrew.Count - 1; i >= 0; i--)
             {
                 unloadCrew(p.protoModuleCrew[i], p, savereturn);
             }
         }
     }
     ves.DespawnCrew();
 }
开发者ID:PrivateFlip,项目名称:RoutineMissionManager,代码行数:14,代码来源:Routine.cs

示例4: store_vessel

 //store vessel
 void store_vessel(Vessel vsl, bool perform_checks = true)
 {
     StoredVessel stored_vessel = new StoredVessel();
     if(perform_checks) //for normal operation
     {
         //check momentary states
         if(!can_store(vsl))
             return;
         //check if the vessel can be stored, if unknown, try to store
         bool storable;
         if(!probed_ids.TryGetValue(vsl.id, out storable))
         {
             stored_vessel = try_store(vsl);
             storable = stored_vessel != null;
             probed_ids.Add(vsl.id, storable);
         }
         if(!storable) return;
     }
     else //for storing packed constructs upon hangar launch
     {
         stored_vessel = new StoredVessel(vsl);
         stored_vessels.ForceAdd(stored_vessel);
     }
     //get vessel crew on board
     List<ProtoCrewMember> _crew = new List<ProtoCrewMember>(stored_vessel.crew);
     CrewTransfer.delCrew(vsl, _crew);
     vsl.DespawnCrew();
     //first of, add crew to the hangar if there's a place
     CrewTransfer.addCrew(part, _crew);
     //then add to other vessel parts if needed
     CrewTransfer.addCrew(vessel, _crew);
     //recalculate volume and mass
     change_part_params(stored_vessel.metric);
     //switch to hangar vessel before storing
     if(FlightGlobals.ActiveVessel.id == vsl.id)
         FlightGlobals.ForceSetActiveVessel(vessel);
     //destroy vessel
     vsl.Die();
     ScreenMessager.showMessage("Vessel has been docked inside the hangar", 3);
 }
开发者ID:kevin-ye,项目名称:hangar,代码行数:41,代码来源:Hangar.cs

示例5: process_vessel

 /// <summary>
 /// Process a vessel that triggered the hangar.
 /// </summary>
 /// <param name="vsl">Vessel</param>
 void process_vessel(Vessel vsl)
 {
     //check if this vessel was encountered before;
     //if so, reset the timer and return
     MemoryTimer timer;
     if(probed_vessels.TryGetValue(vsl.id, out timer))
     { timer.Reset(); return; }
     //if the vessel is new, check momentary states
     if(!hangar_is_ready(vsl)) return;
     //if the state is OK, try to store the vessel
     StoredVessel stored_vessel = try_store_vessel(vsl);
     //if failed, remember it
     if(stored_vessel == null)
     {
         timer = new MemoryTimer();
         timer.EndAction += () => { if(probed_vessels.ContainsKey(vsl.id)) probed_vessels.Remove(vsl.id); };
         probed_vessels.Add(vsl.id, timer);
         StartCoroutine(timer);
         return;
     }
     //deactivate the hangar
     Deactivate();
     //calculate velocity change to conserve momentum
     deltaV = (vsl.orbit.vel-vessel.orbit.vel).xzy*stored_vessel.mass/vessel.GetTotalMass();
     change_velocity = true;
     //get vessel crew on board
     var _crew = new List<ProtoCrewMember>(stored_vessel.crew);
     CrewTransfer.delCrew(vsl, _crew);
     vsl.DespawnCrew();
     //first of, add crew to the hangar if there's a place
     CrewTransfer.addCrew(part, _crew);
     //then add to other vessel parts if needed
     CrewTransfer.addCrew(vessel, _crew);
     //switch to hangar vessel before storing
     if(FlightGlobals.ActiveVessel.id == vsl.id)
         FlightGlobals.ForceSetActiveVessel(vessel);
     //destroy vessel
     vsl.Die();
     ScreenMessager.showMessage("\"{0}\" has been docked inside the hangar", stored_vessel.name);
 }
开发者ID:pjslauta,项目名称:hangar,代码行数:44,代码来源:HangarMachinery.cs

示例6: 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


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