internal void Update(GameTime gameTime) { ((DiffuseLight)SystemCore.ActiveScene.LightsInScene[0]).LightDirection = Vector3.Normalize(Sun.Transform.AbsoluteTransform.Translation); List <GameObject> planets = SystemCore.GameObjectManager.GetAllObjects().FindAll(x => x is Planet); SortForRendering(planets); bool inAtmostphere = false; foreach (Planet p in planets) { double distanceToPlanet = SolarSystem.CalculateDistanceToPlanet(p, PlayerShip.GetComponent <HighPrecisionPosition>().Position); if (distanceToPlanet < p.radius * 2) { p.AddToInfluence(PlayerShip); if (p.HasAtmosphere) { if (WithinAtmosphere(p, PlayerShip)) { PlayerShip.SetInAtmosphere(); inAtmostphere = true; } } } else { p.RemoveFromInfluence(PlayerShip); } } if (!inAtmostphere) { PlayerShip.ExitedAtmosphere(); } }