本文整理汇总了C#中Vessel.GetMasterMechJeb方法的典型用法代码示例。如果您正苦于以下问题:C# Vessel.GetMasterMechJeb方法的具体用法?C# Vessel.GetMasterMechJeb怎么用?C# Vessel.GetMasterMechJeb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vessel
的用法示例。
在下文中一共展示了Vessel.GetMasterMechJeb方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
//.........这里部分代码省略.........
orbitTimeToAp.value = vessel.orbit.timeToAp;
if (vessel.orbit.eccentricity < 1) orbitTimeToPe.value = vessel.orbit.timeToPe;
else orbitTimeToPe.value = -vessel.orbit.meanAnomaly / (2 * Math.PI / vessel.orbit.period);
orbitLAN.value = vessel.orbit.LAN;
orbitArgumentOfPeriapsis.value = vessel.orbit.argumentOfPeriapsis;
orbitInclination.value = vessel.orbit.inclination;
orbitEccentricity.value = vessel.orbit.eccentricity;
orbitSemiMajorAxis.value = vessel.orbit.semiMajorAxis;
latitude.value = vessel.mainBody.GetLatitude(CoM);
longitude.value = MuUtils.ClampDegrees180(vessel.mainBody.GetLongitude(CoM));
if (vessel.mainBody != Planetarium.fetch.Sun)
{
Vector3d delta = vessel.mainBody.getPositionAtUT(Planetarium.GetUniversalTime() + 1) - vessel.mainBody.getPositionAtUT(Planetarium.GetUniversalTime() - 1);
Vector3d plUp = Vector3d.Cross(vessel.mainBody.getPositionAtUT(Planetarium.GetUniversalTime()) - vessel.mainBody.referenceBody.getPositionAtUT(Planetarium.GetUniversalTime()), vessel.mainBody.getPositionAtUT(Planetarium.GetUniversalTime() + vessel.mainBody.orbit.period / 4) - vessel.mainBody.referenceBody.getPositionAtUT(Planetarium.GetUniversalTime() + vessel.mainBody.orbit.period / 4)).normalized;
angleToPrograde = MuUtils.ClampDegrees360((((vessel.orbit.inclination > 90) || (vessel.orbit.inclination < -90)) ? 1 : -1) * ((Vector3)up).AngleInPlane(plUp, delta));
}
else
{
angleToPrograde = 0;
}
mainBody = vessel.mainBody;
radius = (CoM - vessel.mainBody.position).magnitude;
mass = thrustAvailable = thrustMinimum = massDrag = torqueRAvailable = torquePYAvailable = torqueThrustPYAvailable = 0;
rcsThrustAvailable = new Vector6();
rcsTorqueAvailable = new Vector6();
EngineInfo einfo = new EngineInfo(forward, CoM);
IntakeInfo iinfo = new IntakeInfo();
var rcsbal = vessel.GetMasterMechJeb().rcsbal;
if (vessel.ActionGroups[KSPActionGroup.RCS] && rcsbal.enabled)
{
Vector3d rot = Vector3d.zero;
foreach (Vector6.Direction dir6 in Enum.GetValues(typeof(Vector6.Direction)))
{
Vector3d dir = Vector6.directions[dir6];
double[] throttles;
List<RCSSolver.Thruster> thrusters;
rcsbal.GetThrottles(dir, out throttles, out thrusters);
if (throttles != null)
{
for (int i = 0; i < throttles.Length; i++)
{
if (throttles[i] > 0)
{
Vector3d force = thrusters[i].GetThrust(dir, rot);
rcsThrustAvailable.Add(dir * Vector3d.Dot(force * throttles[i], dir));
}
}
}
}
}
foreach (Part p in vessel.parts)
{
if (p.physicalSignificance != Part.PhysicalSignificance.NONE)
{
double partMass = p.TotalMass();
mass += partMass;
massDrag += partMass * p.maximum_drag;
}
示例2: Update
//.........这里部分代码省略.........
orbitSemiMajorAxis.value = vessel.orbit.semiMajorAxis;
latitude.value = vessel.mainBody.GetLatitude(CoM);
longitude.value = MuUtils.ClampDegrees180(vessel.mainBody.GetLongitude(CoM));
if (vessel.mainBody != Planetarium.fetch.Sun)
{
Vector3d delta = vessel.mainBody.getPositionAtUT(Planetarium.GetUniversalTime() + 1) - vessel.mainBody.getPositionAtUT(Planetarium.GetUniversalTime() - 1);
Vector3d plUp = Vector3d.Cross(vessel.mainBody.getPositionAtUT(Planetarium.GetUniversalTime()) - vessel.mainBody.referenceBody.getPositionAtUT(Planetarium.GetUniversalTime()), vessel.mainBody.getPositionAtUT(Planetarium.GetUniversalTime() + vessel.mainBody.orbit.period / 4) - vessel.mainBody.referenceBody.getPositionAtUT(Planetarium.GetUniversalTime() + vessel.mainBody.orbit.period / 4)).normalized;
angleToPrograde = MuUtils.ClampDegrees360((((vessel.orbit.inclination > 90) || (vessel.orbit.inclination < -90)) ? 1 : -1) * ((Vector3)up).AngleInPlane(plUp, delta));
}
else
{
angleToPrograde = 0;
}
mainBody = vessel.mainBody;
radius = (CoM - vessel.mainBody.position).magnitude;
mass = massDrag = torqueThrustPYAvailable = 0;
thrustVectorLastFrame = new Vector3d();
thrustVectorMaxThrottle = new Vector3d();
thrustVectorMinThrottle = new Vector3d();
torqueAvailable = new Vector3d();
rcsThrustAvailable = new Vector6();
rcsTorqueAvailable = new Vector6();
ctrlTorqueAvailable = new Vector6();
EngineInfo einfo = new EngineInfo(CoM);
IntakeInfo iinfo = new IntakeInfo();
parachutes = new List<ModuleParachute>();
var rcsbal = vessel.GetMasterMechJeb().rcsbal;
if (vessel.ActionGroups[KSPActionGroup.RCS] && rcsbal.enabled)
{
Vector3d rot = Vector3d.zero;
foreach (Vector6.Direction dir6 in Enum.GetValues(typeof(Vector6.Direction)))
{
Vector3d dir = Vector6.directions[dir6];
double[] throttles;
List<RCSSolver.Thruster> thrusters;
rcsbal.GetThrottles(dir, out throttles, out thrusters);
if (throttles != null)
{
for (int i = 0; i < throttles.Length; i++)
{
if (throttles[i] > 0)
{
Vector3d force = thrusters[i].GetThrust(dir, rot);
rcsThrustAvailable.Add(dir * Vector3d.Dot(force * throttles[i], dir));
}
}
}
}
}
foreach (Part p in vessel.parts)
{
if (p.physicalSignificance != Part.PhysicalSignificance.NONE)
{
double partMass = p.TotalMass();
mass += partMass;
massDrag += partMass * p.maximum_drag;
}
示例3: ReturnTargetState
private static bool ReturnTargetState(MechJebModuleSmartASS.Target action, Vessel ourVessel)
{
MechJebCore activeJeb = ourVessel.GetMasterMechJeb();
if (activeJeb == null)
return false;
MechJebModuleSmartASS activeSmartass = activeJeb.GetComputerModule<MechJebModuleSmartASS>();
if (activeSmartass == null)
return false;
return action == activeSmartass.target;
}
示例4: 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;
}
//.........这里部分代码省略.........
示例5: EnactTargetAction
// and these are the two functions that actually do the work.
private static void EnactTargetAction(MechJebModuleSmartASS.Target action, Vessel ourVessel)
{
MechJebCore activeJeb = ourVessel.GetMasterMechJeb();
if (activeJeb == null)
return;
MechJebModuleSmartASS activeSmartass = activeJeb.GetComputerModule<MechJebModuleSmartASS>();
if (activeSmartass == null)
return;
activeSmartass.target = action;
activeSmartass.Engage();
}