本文整理汇总了C#中Vessel.GetCrewCapacity方法的典型用法代码示例。如果您正苦于以下问题:C# Vessel.GetCrewCapacity方法的具体用法?C# Vessel.GetCrewCapacity怎么用?C# Vessel.GetCrewCapacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vessel
的用法示例。
在下文中一共展示了Vessel.GetCrewCapacity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getVesselDetail
private KMPVesselDetail getVesselDetail(Vessel vessel)
{
KMPVesselDetail detail = new KMPVesselDetail();
detail.idle = isIdle;
detail.mass = vessel.GetTotalMass();
bool is_eva = false;
bool parachutes_open = false;
//Check if the vessel is an EVA Kerbal
if (vessel.isEVA && vessel.parts.Count > 0 && vessel.parts.First().Modules.Count > 0)
{
foreach (PartModule module in vessel.parts.First().Modules)
{
if (module is KerbalEVA)
{
KerbalEVA kerbal = (KerbalEVA) module;
detail.percentFuel = (byte)Math.Round(kerbal.Fuel / kerbal.FuelCapacity * 100);
detail.percentRCS = byte.MaxValue;
detail.numCrew = byte.MaxValue;
is_eva = true;
break;
}
}
}
if (!is_eva)
{
if (vessel.GetCrewCapacity() > 0)
detail.numCrew = (byte)vessel.GetCrewCount();
else
detail.numCrew = byte.MaxValue;
Dictionary<string, float> fuel_densities = new Dictionary<string, float>();
Dictionary<string, float> rcs_fuel_densities = new Dictionary<string, float>();
bool has_engines = false;
bool has_rcs = false;
foreach (Part part in vessel.parts)
{
foreach (PartModule module in part.Modules)
{
if (module is ModuleEngines)
{
//Determine what kinds of fuel this vessel can use and their densities
ModuleEngines engine = (ModuleEngines)module;
has_engines = true;
foreach (ModuleEngines.Propellant propellant in engine.propellants)
{
if (propellant.name == "ElectricCharge" || propellant.name == "IntakeAir")
{
continue;
}
if (!fuel_densities.ContainsKey(propellant.name))
fuel_densities.Add(propellant.name, PartResourceLibrary.Instance.GetDefinition(propellant.id).density);
}
}
if (module is ModuleRCS)
{
ModuleRCS rcs = (ModuleRCS)module;
if (rcs.requiresFuel)
{
has_rcs = true;
if (!rcs_fuel_densities.ContainsKey(rcs.resourceName))
rcs_fuel_densities.Add(rcs.resourceName, PartResourceLibrary.Instance.GetDefinition(rcs.resourceName).density);
}
}
if (module is ModuleParachute)
{
ModuleParachute parachute = (ModuleParachute)module;
if (parachute.deploymentState == ModuleParachute.deploymentStates.DEPLOYED)
parachutes_open = true;
}
}
}
//Determine how much fuel this vessel has and can hold
float fuel_capacity = 0.0f;
float fuel_amount = 0.0f;
float rcs_capacity = 0.0f;
float rcs_amount = 0.0f;
foreach (Part part in vessel.parts)
{
if (part != null && part.Resources != null)
{
foreach (PartResource resource in part.Resources)
//.........这里部分代码省略.........
示例2: Update
public void Update()
{
//Insta-... key setup
if (insta_chatter_key_just_changed && Input.GetKeyUp(insta_chatter_key)) insta_chatter_key_just_changed = false;
if (insta_sstv_key_just_changed && Input.GetKeyUp(insta_sstv_key)) insta_sstv_key_just_changed = false;
mute_check();
radio_check();
launcherButtonTexture_check();
if (FlightGlobals.ActiveVessel != null)
{
vessel = FlightGlobals.ActiveVessel;
//set num_beep_pages for use in windows
num_beep_pages = beepsource_list.Count / 10;
if (beepsource_list.Count % 10 != 0) num_beep_pages++;
prev_num_pages = num_beep_pages;
//sample selector one-time play
if (OTP_playing && OTP_source.audiosource.isPlaying == false)
{
if (debugging) Debug.Log("[CHATR] one-time play has finished");
OTP_playing = false;
OTP_source.audiosource.clip = OTP_stored_clip;
//if (debugging) Debug.Log("[CHATR] OTP_source.current_clip = " + OTP_source.current_clip);
//set_beep_clip(OTP_source);
}
//update remotetech info if needed
if (remotetech_toggle)
{
rt_update_timer += Time.deltaTime;
if (rt_update_timer > 2f)
{
updateRemoteTechData();
rt_update_timer = 0;
}
}
///////////////////////
///////////////////////
//Do AAE
//BACKGROUND
if (aae_backgrounds_exist)
{
//if vessel not qualified to have onboard noises, stop background audio
if (vessel.GetCrewCapacity() < 1 || vessel.vesselType != VesselType.Ship && vessel.vesselType != VesselType.Station && vessel.vesselType != VesselType.Base && vessel.vesselType != VesselType.Lander)
{
foreach (BackgroundSource src in backgroundsource_list)
{
if (src.audiosource.isPlaying == true)
{
src.audiosource.Stop();
}
}
}
//check if user chose to have only background when on IVA, and then check if in IVA
else if ((aae_backgrounds_onlyinIVA && (CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.IVA || CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.Internal)) || !aae_backgrounds_onlyinIVA)
{
foreach (BackgroundSource src in backgroundsource_list)
{
if (src.audiosource.isPlaying == false)
{
src.audiosource.loop = true;
src.audiosource.Play();
}
}
}
else //else stop background audio
{
foreach (BackgroundSource src in backgroundsource_list)
{
if (src.audiosource.isPlaying == true)
{
src.audiosource.Stop();
}
}
}
}
//SOUNDSCAPE
if (aae_soundscapes_exist)
{
if (aae_soundscape_freq == 0)
{
//turned off
aae_soundscape.Stop();
}
else if (aae_soundscape_freq == 4)
{
//don't play soundscapes when within kerbin atmo
if (vessel.mainBody.bodyName != "Kerbin" || (vessel.mainBody.bodyName == "Kerbin" && (vessel.situation == Vessel.Situations.ORBITING || vessel.situation == Vessel.Situations.ESCAPING)))
{
//continuous loop of clips
if (aae_soundscape.isPlaying == false)
{
//.........这里部分代码省略.........
示例3: VesselIsFull
internal static bool VesselIsFull(Vessel vessel)
{
return !(vessel.GetCrewCount() < vessel.GetCrewCapacity());
}
示例4: handleLoadCrew
//Thanks to sarbian's Kerbal Crew Manifest for showing all this crew handling stuff
private void handleLoadCrew(Vessel ves, int crewCount, int minCrew)
{
//print("crewCount " + crewCount);
//print(ves.GetCrewCapacity());
if (ves.GetCrewCapacity() < crewCount)
crewCount = ves.GetCrewCapacity();
string[] prefCrewNames = new string[0];
getPreferredCrewNames(ref prefCrewNames);
foreach (Part p in ves.parts)
{
if (p.CrewCapacity > p.protoModuleCrew.Count)
{
//print(p.CrewCapacity + " " + p.protoModuleCrew.Count);
for (int i = 0; i < p.CrewCapacity && crewCount > 0; i++)
{
bool added = false;
//tourist
if (minCrew <= 0)
{
foreach (String name in prefCrewNames)
{
if (!added)
{
foreach (ProtoCrewMember cr in HighLogic.CurrentGame.CrewRoster.Tourist)
{
if (name == cr.name && cr.rosterStatus == ProtoCrewMember.RosterStatus.Available)
{
if (AddCrew(p, cr))
{
crewCount = crewCount - 1;
added = true;
}
}
}
}
}
}
//preferred crew
foreach (String name in prefCrewNames)
{
if (!added)
{
foreach (ProtoCrewMember cr in HighLogic.CurrentGame.CrewRoster.Crew)
{
if (name == cr.name && cr.rosterStatus == ProtoCrewMember.RosterStatus.Available)
{
if (AddCrew(p, cr))
{
crewCount = crewCount - 1;
minCrew = minCrew - 1;
added = true;
}
}
}
}
}
//next crew or new crew
//print("one crew start");
//print("crew" + kerbal.name);
if (!added)
{
ProtoCrewMember crew = null;
crew = HighLogic.CurrentGame.CrewRoster.GetNextAvailableKerbal();
if (crew != null)
{
if (AddCrew(p, crew))
{
crewCount = crewCount - 1;
minCrew = minCrew - 1;
added = true;
}
}
}
}
}
}
ves.SpawnCrew();
}