本文整理汇总了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;
}
示例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;
}
示例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;
}
//.........这里部分代码省略.........