OnFixedUpdate() public method

public OnFixedUpdate ( ) : void
return void
Esempio n. 1
0
        void Start()
        {
            Log("Starting");
            try
            {
                mucore.init();
                vesselState = new VesselState();
                attitude    = new AttitudeController(this);
                stage       = new StageController(this);
                attitude.OnStart();
                stagestats            = new StageStats(stage);
                stagestats.editorBody = getVessel.mainBody;
                stagestats.OnModuleEnabled();
                stagestats.OnFixedUpdate();
                stagestats.RequestUpdate(this);
                stagestats.OnFixedUpdate();
                CreateButtonIcon();
                LaunchName = new string(getVessel.vesselName.ToCharArray());
                LaunchBody = getVessel.mainBody;
                launchdb   = new LaunchDB(this);
                launchdb.Load();

                mainWindow      = new Window.MainWindow(this, 6378070);
                flightMapWindow = new Window.FlightMapWindow(this, 548302);
                statsWindow     = new Window.StatsWindow(this, 6378070 + 4);

                GameEvents.onShowUI.Add(ShowGUI);
                GameEvents.onHideUI.Add(HideGUI);
            }
            catch (Exception ex)
            {
                Log(ex.ToString());
            }
        }
Esempio n. 2
0
 void Start()
 {
     mucore.init();
     vesselState = new VesselState();
     attitude = new AttitudeController(this);
     stage = new StageController(this);
     attitude.OnStart();
     RenderingManager.AddToPostDrawQueue(3, new Callback(drawGUI));//start the GUI
     helpWindowPos = new Rect(windowPos.x+windowPos.width, windowPos.y, 0, 0);
     stagestats = new StageStats();
     stagestats.editorBody = vessel.mainBody;
     stagestats.OnModuleEnabled();
     stagestats.OnFixedUpdate();
     stagestats.RequestUpdate(this);
     stagestats.OnFixedUpdate();
     CreateButtonIcon();
 }
Esempio n. 3
0
        void Start()
        {
            instance = this;
            Log("Starting");
            try
            {
                mucore.init();
                vesselState = new VesselState();
                attitude    = new AttitudeController(this);
                stage       = new StageController(this);
                attitude.OnStart();
                stagestats            = new StageStats(stage);
                stagestats.editorBody = getVessel.mainBody;
                stagestats.OnModuleEnabled();
                stagestats.OnFixedUpdate();
                stagestats.RequestUpdate(this);
                stagestats.OnFixedUpdate();
                CreateButtonIcon();
                LaunchName = new string(getVessel.vesselName.ToCharArray());
                LaunchBody = getVessel.mainBody;
                launchdb   = new LaunchDB(this);
                launchdb.Load();

                mainWindow      = new Window.MainWindow(this, 6378070);
                flightMapWindow = new Window.FlightMapWindow(this, 548302);
                statsWindow     = new Window.StatsWindow(this, 6378070 + 4);
                double h = 80f;
                if (FlightGlobals.ActiveVessel.mainBody.atmosphere)
                {
                    h = Math.Max(h, FlightGlobals.ActiveVessel.mainBody.atmosphereDepth + 10000f);
                    DestinationHeight = new EditableValue(h, locked: true) / 1000;
                }

                delayUT = double.NaN;

                GameEvents.onShowUI.Add(ShowGUI);
                GameEvents.onHideUI.Add(HideGUI);

                LoadKeybind();
            }
            catch (Exception ex)
            {
                Log(ex.ToString());
            }
        }
Esempio n. 4
0
        void FixedUpdate()
        {
            if (Launching)
            {
                stagestats.editorBody = getVessel.mainBody;
                vesselState.Update(getVessel);
                attitude.OnFixedUpdate();
                stagestats.OnFixedUpdate();
                stagestats.RequestUpdate(this);
                if (flightMapWindow.flightMap != null && Launching)
                {
                    flightMapWindow.flightMap.UpdateMap(getVessel);
                }
            }
            else if (EnableStats && !getVessel.Landed && !getVessel.IsInStableOrbit())
            {
                CalculateLosses(getVessel);
                stagestats.editorBody = getVessel.mainBody;
                vesselState.Update(getVessel);
                attitude.OnFixedUpdate();
                stagestats.OnFixedUpdate();
                stagestats.RequestUpdate(this);
            }
            else if (EnableStats && !getVessel.Landed && getVessel.IsInStableOrbit())
            {
                if (VectorLoss > 0.01)
                {
                    Message = string.Format(
                        "Total Vector Loss:\t{0:0.00} m/s\n" +
                        "Total Loss:\t{1:0.00} m/s\n" +
                        "Total Burn:\t\t{2:0.0}\n\n",
                        VectorLoss,
                        TotalLoss,
                        TotalBurn
                        );
                }
                else
                {
                    Message = "";
                }

                Message += string.Format(
                    "Apoapsis:\t\t{0}\n" +
                    "Periapsis:\t\t{1}\n" +
                    "Inclination:\t\t{2:0.0} °\n",
                    OrbitExtensions.FormatOrbitInfo(getVessel.orbit.ApA, getVessel.orbit.timeToAp),
                    OrbitExtensions.FormatOrbitInfo(getVessel.orbit.PeA, getVessel.orbit.timeToPe),
                    getVessel.orbit.inclination
                    );
            }
            else if (EnableStats && getVessel.Landed)
            {
                double diffUT = Planetarium.GetUniversalTime() - delayUT;
                if (diffUT > 1 || Double.IsNaN(delayUT))
                {
                    vesselState.Update(getVessel);
                    stagestats.OnFixedUpdate();
                    stagestats.RequestUpdate(this);
                    Message = PreflightInfo(getVessel);
                    delayUT = Planetarium.GetUniversalTime();
                }
            }
        }
Esempio n. 5
0
 void Start()
 {
     Log("Starting");
     try
     {
         mucore.init();
         vesselState = new VesselState();
         attitude = new AttitudeController(this);
         stage = new StageController(this);
         attitude.OnStart();
         stagestats = new StageStats();
         stagestats.editorBody = getVessel.mainBody;
         stagestats.OnModuleEnabled();
         stagestats.OnFixedUpdate();
         stagestats.RequestUpdate(this);
         stagestats.OnFixedUpdate();
         CreateButtonIcon();
         LaunchName = new string(getVessel.vesselName.ToCharArray());
         LaunchBody = getVessel.mainBody;
         launchdb = new LaunchDB(this);
         launchdb.Load();
         mainWindow = new Window.MainWindow(this, 6378070);
         flightMapWindow = new Window.FlightMapWindow(this, 548302);
     }
     catch (Exception ex)
     {
         Log(ex.ToString());
     }
 }