public void Update()
{
computationTime_ = computationTime_ * 0.99f + frameTime_ * 0.01f;
float offset = frameTime_ - computationTime_;
frameTime_ = 0;
if (gameFrameTime_ != null)
{
float t = (float)gameFrameTime_.ElapsedMilliseconds;
averageGameFrameTime_ = averageGameFrameTime_ * 0.99f + t * 0.01f;
}
gameFrameTime_ = Stopwatch.StartNew();
if (HighLogic.LoadedScene == GameScenes.FLIGHT && vessel_ != FlightGlobals.ActiveVessel)
{
TrajectoriesVesselSettings module = FlightGlobals.ActiveVessel == null ? null : FlightGlobals.ActiveVessel.Parts.SelectMany(p => p.Modules.OfType<TrajectoriesVesselSettings>()).FirstOrDefault();
CelestialBody body = module == null ? null : FlightGlobals.Bodies.FirstOrDefault(b => b.name == module.targetReferenceBody);
if (body == null || !module.hasTarget)
{
SetTarget();
}
else
{
SetTarget(body, body.transform.TransformDirection(module.targetLocation));
}
}
if (HighLogic.LoadedScene == GameScenes.FLIGHT && FlightGlobals.ActiveVessel != null && FlightGlobals.ActiveVessel.Parts.Count != 0 && ((MapView.MapIsEnabled && Settings.fetch.DisplayTrajectories) || Settings.fetch.AlwaysUpdate || targetPosition_.HasValue))
{
ComputeTrajectory(FlightGlobals.ActiveVessel, DescentProfile.fetch, true);
}
}