當前位置: 首頁>>代碼示例>>C#>>正文


C# MechJebCore.GetComputerModule方法代碼示例

本文整理匯總了C#中MuMech.MechJebCore.GetComputerModule方法的典型用法代碼示例。如果您正苦於以下問題:C# MechJebCore.GetComputerModule方法的具體用法?C# MechJebCore.GetComputerModule怎麽用?C# MechJebCore.GetComputerModule使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MuMech.MechJebCore的用法示例。


在下文中一共展示了MechJebCore.GetComputerModule方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ProcessVariable

		public object ProcessVariable(string variable)
		{
			activeJeb = vessel.GetMasterMechJeb();
			switch (variable) {
				case "MECHJEBAVAILABLE":
					if (activeJeb != null)
						return 1;
					return -1;
				case "DELTAV":
					if (activeJeb != null) {
						MechJebModuleStageStats stats = activeJeb.GetComputerModule<MechJebModuleStageStats>();
						stats.RequestUpdate(this);
						return stats.vacStats.Sum(s => s.deltaV);
					}
					return null;
				case "DELTAVSTAGE":
					if (activeJeb != null) {
						MechJebModuleStageStats stats = activeJeb.GetComputerModule<MechJebModuleStageStats>();
						stats.RequestUpdate(this);
						return stats.vacStats[stats.vacStats.Length - 1].deltaV;
					}
					return null;
				case "PREDICTEDLANDINGERROR":
					// If there's a failure at any step, exit with a -1.
					// The landing prediction system can be costly, and it
					// expects someone to be registered with it for it to run.
					// So, we'll have a MechJebRPM button to enable landing
					// predictions.  And maybe add it in to the MJ menu.
					if (activeJeb != null && activeJeb.target.PositionTargetExists == true) {
						var predictor = activeJeb.GetComputerModule<MechJebModuleLandingPredictions>();
						if (predictor != null && predictor.enabled) {
							ReentrySimulation.Result result = predictor.GetResult();
							if (result != null && result.outcome == ReentrySimulation.Outcome.LANDED) {
								// We're going to hit something!
								double error = Vector3d.Distance(vessel.mainBody.GetRelSurfacePosition(result.endPosition.latitude, result.endPosition.longitude, 0),
									               vessel.mainBody.GetRelSurfacePosition(activeJeb.target.targetLatitude, activeJeb.target.targetLongitude, 0));
								return error;
							}
						}
					}
					return -1;
			}
			return null;
		}
開發者ID:dreadicon,項目名稱:RasterPropMonitor,代碼行數:44,代碼來源:MechJebRPMVariables.cs

示例2: foreach

 /* Note to self:
 foreach (ThatEnumType item in (ThatEnumType[]) Enum.GetValues(typeof(ThatEnumType)))
 can save a lot of time here.
 */
 private void UpdateJebReferences()
 {
     activeJeb = vessel.GetMasterMechJeb();
     // Node executor is activeJeb.node
     activeSmartass = activeJeb != null ? activeJeb.GetComputerModule<MechJebModuleSmartASS>() : null;
 }
開發者ID:Tahvohck,項目名稱:RasterPropMonitor,代碼行數:10,代碼來源:MechJebRPM.cs

示例3: LateUpdate

		protected override void LateUpdate()
		{
			if (shutdown)
				return;

			if (!HighLogic.LoadedSceneIsFlight || !FlightGlobals.ready)
				return;

			if (SCANcontroller.controller == null)
			{
				way = null;
				return;
			}

			if (!SCANcontroller.controller.mechJebTargetSelection)
			{
				way = null;
				return;
			}

			v = FlightGlobals.ActiveVessel;

			if (v == null)
			{
				SCANcontroller.controller.MechJebLoaded = false;
				way = null;
				return;
			}

			if (v.mainBody != SCANcontroller.controller.LandingTargetBody)
				SCANcontroller.controller.LandingTargetBody = v.mainBody;

			data = SCANUtil.getData(v.mainBody);

			if (data == null)
			{
				SCANcontroller.controller.MechJebLoaded = false;
				way = null;
				return;
			}

			if (v.FindPartModulesImplementing<MechJebCore>().Count <= 0)
			{
				SCANcontroller.controller.MechJebLoaded = false;
				way = null;
				return;
			}

			core = v.GetMasterMechJeb();

			if (core == null)
			{
				SCANcontroller.controller.MechJebLoaded = false;
				way = null;
				return;
			}

			if (HighLogic.CurrentGame.Mode != Game.Modes.SANDBOX)
			{
				if (guidanceModule == null)
					guidanceModule = (DisplayModule)core.GetComputerModule("MechJebModuleLandingGuidance");

				if (guidanceModule == null)
				{
					SCANcontroller.controller.MechJebLoaded = false;
					way = null;
					return;
				}

				if (!guidanceModule.unlockChecked)
					return;

				if (guidanceModule.hidden)
				{
					SCANcontroller.controller.MechJebLoaded = false;
					shutdown = true;
					way = null;
					return;
				}
			}

			target = core.target;

			if (target == null)
			{
				SCANcontroller.controller.MechJebLoaded = false;
				way = null;
				return;
			}

			if (!SCANcontroller.controller.MechJebLoaded)
			{
				SCANcontroller.controller.MechJebLoaded = true;
				RenderingManager.AddToPostDrawQueue(1, drawTarget);
			}

			if (SCANcontroller.controller.LandingTarget != null)
			{
				way = SCANcontroller.controller.LandingTarget;
			}
//.........這裏部分代碼省略.........
開發者ID:DBT85,項目名稱:SCANsat,代碼行數:101,代碼來源:SCANmechjeb.cs


注:本文中的MuMech.MechJebCore.GetComputerModule方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。