Trajectories.Trajectory.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
        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);
            }
        }

Usage Example

示例#1
0
        /*public override void OnSave(ConfigNode node)
         * {
         *  if (node == null)
         *      return;
         *
         *  Util.DebugLog("Node: {0}", node.name);
         *
         *  //node.AddValue("version", Version);                       // save version
         * }*/

        internal void Update()
        {
            if (Util.IsPaused || Settings == null || !Util.IsFlight)
            {
                return;
            }

            if (AttachedVessel != FlightGlobals.ActiveVessel)
            {
                AttachVessel();
            }

            Trajectory.Update();
            MapOverlay.Update();
            FlightOverlay.Update();
            NavBallOverlay.Update();
            MainGUI.Update();
        }
All Usage Examples Of Trajectories.Trajectory::Update