public void UpdateOwners()
{
EmpiresWithPlanetsInThisSystem = new List<Empire>();
int amountOfPlanetsOwned = 0;
Dictionary<Empire, int> planetsOwned = new Dictionary<Empire,int>();
OwnerPercentage = new Dictionary<Empire, float>();
foreach (Planet planet in planets)
{
if (planet.Owner != null)
{
if (!EmpiresWithPlanetsInThisSystem.Contains(planet.Owner))
{
EmpiresWithPlanetsInThisSystem.Add(planet.Owner);
planetsOwned.Add(planet.Owner, 1);
}
else
{
planetsOwned[planet.Owner] += 1;
}
amountOfPlanetsOwned++;
}
}
//Update the color percentage here
foreach (KeyValuePair<Empire, int> keyValuePair in planetsOwned)
{
OwnerPercentage[keyValuePair.Key] = ((float)keyValuePair.Value / (float)amountOfPlanetsOwned);
}
UpdateDominantEmpire();
}