public void UpdatePopGrowth()
{
//this function calculates regular pop growth plus any bonuses or negatives
List<Planet> planetsToRemove = new List<Planet>();
foreach (Planet planet in _planets)
{
planet.UpdatePlanet();
foreach (Race race in planet.Races)
{
if (planet.GetRacePopulation(race) < 0.1)
{
//This race died out
planet.RemoveRace(race);
}
}
if (planet.TotalPopulation == 0.0)
{
//Planet died out
planet.Owner = null;
planetsToRemove.Add(planet);
}
}
foreach (Planet planet in planetsToRemove)
{
//those planets died out
_planets.Remove(planet);
}
}