本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
}
}