Exemplo n.º 1
0
 public void FixedUpdate()
 {
     while (!PhysicsReady && HighLogic.LoadedSceneIsFlight)
     {
         ThreadDispatcher.DequeueFromWorker(wait: true);
     }
 }
Exemplo n.º 2
0
        public void Update()
        {
            KSPPlanet CurrentPlanet;

            planets.TryGetValue(FlightGlobals.currentMainBody ?? FlightGlobals.Bodies.FirstOrDefault(x => x.name == "Kerbin"), out CurrentPlanet);

            if (CurrentPlanet != LastPlanet)
            {
                Utils.Log("Planet changed: {0} => {1}", LastPlanet == null ? "(null)" : LastPlanet.Body.name, CurrentPlanet == null ? "(null)" : CurrentPlanet.Body.name);
                LastPlanet = CurrentPlanet;
            }

            if (CurrentPlanet != null)
            {
                if (FlightGlobals.ActiveVessel == null)
                {
                    CurrentPlanet.UpdatePosition(Coordinates.KSC);
                }
                else
                {
                    CurrentPlanet.UpdatePosition(new Coordinates(FlightGlobals.ActiveVessel.latitude * Math.PI / 180, FlightGlobals.ActiveVessel.longitude * Math.PI / 180));
                }
            }

            ThreadDispatcher.DequeueFromWorker(20);
        }