public Vector3 UpdatePlanets()
{
for (int i = 0; i < this.Planets.Count; i++) {
KeyValuePair<Planet, float> p = this.Planets [i];
float dist = (p.Key.TruePos.TruePos - this.TruePos.TruePos).magnitude;
this.Planets [i] = new KeyValuePair<Planet, float> (p.Key, dist);
if (i - 1 >= 0) {
KeyValuePair<Planet, float> pPrev = this.Planets [i - 1];
if (p.Value < pPrev.Value) {
this.Planets [i] = pPrev;
this.Planets [i - 1] = p;
if (this.SelectedPlanetIndex == i) {
this.SelectedPlanetIndex = i - 1;
}
else if (this.SelectedPlanetIndex == i - 1) {
this.SelectedPlanetIndex = i;
}
}
}
}
Vector3 gravity = this.Planets [0].Key.Grav.GetAttractionFor (this.gameObject);
float altitude = this.Planets [0].Value - this.Planets [0].Key.radius;
float a = (this.Planets [0].Key.atmRange - altitude) / this.Planets [0].Key.atmRange * this.Planets [0].Key.atmDensity;;
if (a > 0) {
this.localAtm += a;
}
return gravity;
}