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


C# Vessel.GetCrewCount方法代码示例

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


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

示例1: Start

        public void Start()
        {
            activeVessel = FlightGlobals.ActiveVessel;
            if (activeVessel.GetCrewCount() > 0)
                crews = new CSXCrewManagement(activeVessel);
            if (activeVessel != null)
                parts = new CSXPartManagement(activeVessel);

            Debug.Log("[CSX Industry] Parts in total: " + parts.PartLength());
        }
开发者ID:CSXIndustry,项目名称:LifeSupport,代码行数:10,代码来源:CSXLifeSupport.cs

示例2: OnVesselCreate

 private void OnVesselCreate(Vessel vessel)
 {
     //Kerbals are put in the vessel *after* OnVesselCreate. Thanks squad!.
     if (vesselToKerbal.ContainsKey(vessel.id))
     {
         OnVesselDestroyed(vessel);
     }
     if (vessel.GetCrewCount() > 0)
     {
         vesselToKerbal.Add(vessel.id, new List<string>());
         foreach (ProtoCrewMember pcm in vessel.GetVesselCrew())
         {
             vesselToKerbal[vessel.id].Add(pcm.name);
             if (kerbalToVessel.ContainsKey(pcm.name) && kerbalToVessel[pcm.name] != vessel.id)
             {
                 DarkLog.Debug("Warning, kerbal double take on " + vessel.id + " ( " + vessel.name + " )");
             }
             kerbalToVessel[pcm.name] = vessel.id;
             DarkLog.Debug("OVC " + pcm.name + " belongs to " + vessel.id);
         }
     }
 }
开发者ID:Opice,项目名称:DarkMultiPlayer,代码行数:22,代码来源:KerbalReassigner.cs

示例3: getHCUParts

 // Find parts that need a HCU to transfer.
 private Dictionary<Part, string> getHCUParts(Vessel craft)
 {
     HCUCost = 0;
     Array highEnergyResources = new string[14] { "karborundum", "uranium", "uraninite", "plutonium", "antimatter", "thorium", "nuclear", "exotic", "actinides", "chargedparticles", "fluorine", "lqdhe3", "tritium", "thf4"};
     Dictionary<Part, string> HCUParts = new Dictionary<Part, string>();
     foreach (Part vpart in vessel.Parts)
     {
         foreach (PartResource vres in vpart.Resources)
         {
             foreach (string checkr in highEnergyResources)
             if (vres.resourceName.ToLower().Contains(checkr) && vres.amount > 0)
             {
                 if (HCUParts.Keys.Contains<Part>(vpart)) continue;
                 HCUCost += (vres.info.density * vres.amount * 0.1) / 0.0058;
                 HCUParts.Add(vpart, vres.resourceName);
             }
         }
     }
     HCUCost += craft.GetCrewCount() * 0.9 / 1.13;
     HCUCost = Math.Round(HCUCost * 100) / 100;
     return HCUParts;
 }
开发者ID:Kerbas-ad-astra,项目名称:ESLDBeacons,代码行数:23,代码来源:ESLDHailer.cs

示例4: RemoteCore

        public RemoteCore(Vessel v, float energyDrain)
        {
            if (v == null) return;
            vessel = v;
            this.EnergyDrain = energyDrain;

            settings = new SatSettings(this);
            computer = new FlightComputer(this);
            flightComputerGUI = new FlightComputerGUI(this);

            Rnode = new RelayNode(vessel);

            try
            {
                vessel.OnFlyByWire -= new FlightInputCallback(this.drive);
            }
            catch { }
            try
            {
                vessel.OnFlyByWire += new FlightInputCallback(this.drive);
            }
            catch { }

            GetCommandPath();

            UpdateOtherModules();

            planetariumCamera = (PlanetariumCamera)GameObject.FindObjectOfType(typeof(PlanetariumCamera));

            obj = new GameObject("Line");

            line = null;

            obj.layer = 9;
            line = obj.AddComponent<LineRenderer>();
            line.useWorldSpace = true;
            line.material = new Material(Shader.Find("Particles/Additive"));
            line.SetColors(Color.blue, Color.blue);
            line.SetWidth(0, 0);

            localControl = vessel.GetCrewCount() > 0 || MechJeb;
        }
开发者ID:JDPKSP,项目名称:RemoteTechLegacy,代码行数:42,代码来源:RemoteCore.cs

示例5: VesselIsFull

 internal static bool VesselIsFull(Vessel vessel)
 {
     return !(vessel.GetCrewCount() < vessel.GetCrewCapacity());
 }
开发者ID:JPLRepo,项目名称:RosterManager,代码行数:4,代码来源:RMAddon.cs

示例6: GetCrewCount

 private int GetCrewCount(Vessel vessel)
 {
     if (vessel.packed && !vessel.loaded)
     {
         return vessel.protoVessel.GetVesselCrew().Count;
     }
     else
     {
         return vessel.GetCrewCount();
     }
 }
开发者ID:Kerbas-ad-astra,项目名称:Timmers_KSP,代码行数:11,代码来源:KeepFitCrewRosterController.cs

示例7: isProbeValid

        private bool isProbeValid(Vessel v)
        {
            if (v == null)
                return false;

            if (!v.IsControllable)
                return false;

            if (v.GetCrewCount() > 0)
                return false;

            if (v.launchTime < this.Root.DateAccepted)
                return false;

            hasAntenna = Util.shipHasModuleList(new List<string> { "ModuleDataTransmitter", "ModuleLimitedDataTransmitter", "ModuleRTDataTransmitter", "ModuleRTAntenna" });
            hasPowerGenerator = Util.shipHasModuleList(new List<string> { "ModuleGenerator", "ModuleDeployableSolarPanel", "FNGenerator", "FNAntimatterReactor", "FNNuclearReactor", "FNFusionReactor", "KolonyConverter", "FissionGenerator", "ModuleCurvedSolarPanel" });

            if (hasPowerGenerator && hasAntenna)
                return true;
            else
                return false;
        }
开发者ID:stanbeard,项目名称:FinePrint,代码行数:22,代码来源:ProbeSystemsParameter.cs

示例8: RemoveSnacks

 /**
 * Removes the calculated number of snacks from the vessel.
 * returns the number of snacks that were required, but missing.
 * */
 public double RemoveSnacks(Vessel v)
 {
     double demand = v.GetVesselCrew().Count * snacksPer;
     double extra = CalculateExtraSnacksRequired(v.GetVesselCrew());
     //Debug.Log("SnackDemand(" + v.vesselName + "): e: " + extra + " r:" + demand);
     if ((demand + extra) <= 0)
         return 0;
     double fed = GetSnackResource(v.rootPart, demand + extra);
     //Debug.Log("fed" + fed + v.vesselName);
     if (fed == 0)//unable to feed, no skipping or extra counted
         return v.GetCrewCount() * snacksPer;
     return demand + extra - fed;
 }
开发者ID:Murdabenne,项目名称:Snacks,代码行数:17,代码来源:SnackConsumer.cs

示例9: 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)
//.........这里部分代码省略.........
开发者ID:Jumba,项目名称:KerbalMultiPlayer,代码行数:101,代码来源:KMPManager.cs

示例10: try_store

 StoredVessel try_store(Vessel vsl)
 {
     //check vessel crew
     if(vsl.GetCrewCount() > vessel.GetCrewCapacity()-vessel.GetCrewCount())
     {
         ScreenMessager.showMessage("Not enough space for the crew of a docking vessel", 3);
         return null;
     }
     //check vessel metrics
     GetLaunchTransform();
     StoredVessel sv = new StoredVessel(vsl);
     if(!sv.metric.FitsAligned(launchTransform, part.partTransform, hangar_metric))
     {
         ScreenMessager.showMessage("The vessel does not fit into this hangar", 3);
         return null;
     }
     if(!stored_vessels.Add(sv))
     {
         ScreenMessager.showMessage("There's no room in the hangar for this vessel", 3);
         return null;
     }
     return sv;
 }
开发者ID:kevin-ye,项目名称:hangar,代码行数:23,代码来源:Hangar.cs

示例11: try_store_vessel

 StoredVessel try_store_vessel(Vessel vsl)
 {
     //check vessel crew
     var vsl_crew = vsl.GetCrewCount();
     if(NoCrewTransfers && vsl_crew > 0)
     {
         ScreenMessager.showMessage("Crew cannot enter through this hangar. Leave your ship before docking.");
         return null;
     }
     if(vsl_crew > vessel.GetCrewCapacity()-vessel.GetCrewCount())
     {
         ScreenMessager.showMessage("Not enough space for the crew of a docking vessel");
         return null;
     }
     //check vessel metrics
     var sv = new StoredVessel(vsl, Storage.ComputeHull);
     return try_store_vessel(sv) ? sv : null;
 }
开发者ID:pjslauta,项目名称:hangar,代码行数:18,代码来源:HangarMachinery.cs

示例12: GetVesselInfo

        private VesselInfo GetVesselInfo(Vessel vessel, double currentTime)
        {
            VesselInfo vesselInfo;
            if (knownVessels.ContainsKey(vessel.id))
            {
                vesselInfo = knownVessels[vessel.id];
            }
            else
            {
                vesselInfo = new VesselInfo(currentTime);
                knownVessels[vessel.id] = vesselInfo;
            }

            vesselInfo.numCrew = vessel.GetCrewCount();
            vesselInfo.ClearResourceAmounts();

            foreach (Part part in vessel.parts)
            {
                foreach (PartResource resource in part.Resources)
                {
                    if (resource.info.id == settings.FoodId)
                    {
                        vesselInfo.remainingFood += resource.amount;
                        vesselInfo.maxFood += resource.maxAmount;
                    }
                    else if (resource.info.id == settings.WaterId)
                    {
                        vesselInfo.remainingWater += resource.amount;
                        vesselInfo.maxWater += resource.maxAmount;
                    }
                    else if (resource.info.id == settings.OxygenId)
                    {
                        vesselInfo.remainingOxygen += resource.amount;
                        vesselInfo.maxOxygen += resource.maxAmount;
                    }
                    else if (resource.info.id == settings.ElectricityId)
                    {
                        vesselInfo.remainingElectricity += resource.amount;
                        vesselInfo.maxElectricity += resource.maxAmount;
                    }
                    else if (resource.info.id == settings.CO2Id)
                    {
                        vesselInfo.remainingCO2 += resource.amount;
                    }
                    else if (resource.info.id == settings.WasteId)
                    {
                        vesselInfo.remainingWaste += resource.amount;
                    }
                    else if (resource.info.id == settings.WasteWaterId)
                    {
                        vesselInfo.remainingWasteWater += resource.amount;
                    }
                }
            }

            ShowWarnings(vessel, vesselInfo.remainingFood, vesselInfo.maxFood, settings.FoodConsumptionRate / vesselInfo.numCrew, "Food", ref vesselInfo.foodStatus);
            ShowWarnings(vessel, vesselInfo.remainingWater, vesselInfo.maxWater, settings.WaterConsumptionRate / vesselInfo.numCrew, "Water", ref vesselInfo.waterStatus);
            ShowWarnings(vessel, vesselInfo.remainingOxygen, vesselInfo.maxOxygen, settings.OxygenConsumptionRate / vesselInfo.numCrew, "Oxygen", ref vesselInfo.oxygenStatus);
            ShowWarnings(vessel, vesselInfo.remainingElectricity, vesselInfo.maxElectricity, CalculateElectricityConsumptionRate(vessel, vesselInfo), "Electric Charge", ref vesselInfo.electricityStatus);

            return vesselInfo;
        }
开发者ID:NathanKell,项目名称:TacLifeSupport,代码行数:62,代码来源:LifeSupportController.cs

示例13: VesselIsUncrewed

        public bool VesselIsUncrewed(Vessel vVessel)
        {
            int iCrew = 0;

            if (vVessel == null) return false;

            if (vVessel.loaded)
                iCrew = vVessel.GetCrewCount();
            else
                iCrew = vVessel.protoVessel.protoPartSnapshots.Sum(pps => pps.protoModuleCrew.Count);

            if (iCrew < 1) return true;

            return false;
        }
开发者ID:AlphaAsh,项目名称:Kerbal-Konstructs_DEV,代码行数:15,代码来源:DownlinkGUI.cs

示例14: getVesselUpdate


//.........这里部分代码省略.........
            if (isInSafetyBubble(vessel.GetWorldPos3D(),vessel.mainBody,vessel.altitude)) update.clearProtoVessel();

            //Track vessel situation
            sentVessels_Situations[vessel.id] = vessel.situation;

            //Set privacy lock
            if (serverVessels_IsPrivate.ContainsKey(vessel.id)) update.isPrivate = serverVessels_IsPrivate[vessel.id];
            else update.isPrivate = false;

            if (vessel.vesselName.Length <= MAX_VESSEL_NAME_LENGTH)
                update.name = vessel.vesselName;
            else
                update.name = vessel.vesselName.Substring(0, MAX_VESSEL_NAME_LENGTH);

            update.player = playerName;
            update.id = vessel.id;
            update.tick = Planetarium.GetUniversalTime();

            if (serverVessels_RemoteID.ContainsKey(vessel.id)) update.kmpID = serverVessels_RemoteID[vessel.id];
            else
            {
                Log.Debug("Generating new remote ID for vessel: " + vessel.id);
                Guid server_id = Guid.NewGuid();
                serverVessels_RemoteID[vessel.id] = server_id;
                update.kmpID = server_id;
                if (vessel.vesselType == VesselType.Flag)
                {
                    newFlags[vessel.id] = UnityEngine.Time.realtimeSinceStartup;
                }
            }

            if (idOnlyUpdate) return update;

            update.crewCount = vessel.GetCrewCount();

            Vector3 pos = vessel.mainBody.transform.InverseTransformPoint(vessel.GetWorldPos3D());
            Vector3 dir = vessel.mainBody.transform.InverseTransformDirection(vessel.transform.up);
            Vector3 vel = vessel.mainBody.transform.InverseTransformDirection(vessel.GetObtVelocity());
            Vector3d o_vel = vessel.obt_velocity;
            Vector3d s_vel = vessel.srf_velocity;
            Vector3 forw = vessel.mainBody.transform.InverseTransformDirection(vessel.transform.forward);

            for (int i = 0; i < 3; i++)
            {
                update.pos[i] = pos[i];
                update.dir[i] = dir[i];
                update.vel[i] = vel[i];
                update.o_vel[i] = o_vel[i];
                update.s_vel[i] = s_vel[i];
                update.rot[i] = forw[i];
            }

            update.w_pos[0] = vessel.orbit.LAN;
            if (vessel.situation == Vessel.Situations.LANDED || vessel.situation == Vessel.Situations.SPLASHED)
            {
                update.w_pos[1] = vessel.latitude;
                update.w_pos[2] = vessel.longitude;
            }

            //Determine situation
            if ((vessel.loaded && vessel.GetTotalMass() <= 0.0) || (vessel.vesselType == VesselType.Debris && vessel.situation == Vessel.Situations.SUB_ORBITAL))
                update.situation = Situation.DESTROYED;
            else
            {
                switch (vessel.situation)
                {
开发者ID:vosechu,项目名称:KerbalMultiPlayer,代码行数:67,代码来源:KMPManager.cs

示例15: getValues

        /// <summary>
        /// Returns all values related to this mission goal
        /// </summary>
        /// <returns>The values.</returns>
        /// <param name="vessel">current vessel</param>
        public List<Value> getValues(Vessel vessel, GameEvent events)
        {
            List<Value> vs = values (vessel, events);

            if (crewCount != 0) {
                if(vessel == null) {
                    vs.Add (new Value ("Crew count", "" + crewCount));
                } else {
                    vs.Add (new Value ("Crew count", "" + crewCount, "" + vessel.GetCrewCount (),
                                   crewCount <= vessel.GetCrewCount ()));
                }
            }

            if (minTotalMass != 0.0) {
                if (vessel == null) {
                    vs.Add(new Value("min. total mass", String.Format(MathTools.SingleDoubleValue, minTotalMass)));
                } else {
                    vs.Add(new Value("min. total mass", String.Format(MathTools.SingleDoubleValue, minTotalMass),
                                     String.Format(MathTools.SingleDoubleValue, vessel.GetTotalMass()),
                                     vessel.GetTotalMass() >= minTotalMass));
                }
            }

            if (maxTotalMass != 0.0) {
                if (vessel == null) {
                    vs.Add(new Value("max. total mass", String.Format(MathTools.SingleDoubleValue, maxTotalMass)));
                } else {
                    vs.Add(new Value("max. total mass", String.Format(MathTools.SingleDoubleValue, maxTotalMass),
                                     String.Format(MathTools.SingleDoubleValue, vessel.GetTotalMass()),
                                     vessel.GetTotalMass() <= maxTotalMass));
                }
            }

            bool done = true;
            foreach (Value v in vs) {
                done = done && v.done;
            }

            // If the mission goal is finished so far and we need to throttle down in order
            // to finish the mission goal, add another value if not throttled down
            if (vessel != null) {
                if (done && throttleDown && FlightInputHandler.state.mainThrottle != 0.0) {
                    vs.Add (new Value ("Throttle down!", "true", "false", false));
                    done = false;
                }
            }

            if (done && timeStarted == -1.0 && minSeconds > 0.0) {
                timeStarted = Planetarium.GetUniversalTime ();
            }

            if (minSeconds > 0.0 && !done) {
                timeStarted = -1.0;
            }

            if (minSeconds > 0.0) {
                if (vessel != null) {
                    double diff = (timeStarted == -1.0 ? 0 : Planetarium.GetUniversalTime () - timeStarted);
                    vs.Add (new Value("Minimal time", MathTools.formatTime(minSeconds), MathTools.formatTime(diff), diff > minSeconds));
                } else {
                    vs.Add (new Value("Minimal time", MathTools.formatTime(minSeconds)));
                }
            }

            return vs;
        }
开发者ID:pweingardt,项目名称:KSPMissionController,代码行数:71,代码来源:MissionGoal.cs


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