private void UpdateDominantEmpire()
{
Dictionary<Empire, int> count = new Dictionary<Empire, int>();
foreach (Planet planet in planets)
{
if (planet.Owner != null)
{
if (count.ContainsKey(planet.Owner))
{
count[planet.Owner] = count[planet.Owner] + 1;
}
else
{
count.Add(planet.Owner, 1);
}
}
}
int biggestCount = 0;
Empire biggestOwner = null;
foreach (KeyValuePair<Empire, int> empire in count)
{
if (biggestCount < empire.Value)
{
biggestCount = empire.Value;
biggestOwner = empire.Key;
}
}
DominantEmpire = biggestOwner;
}