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