Skip to content

Commit

Permalink
Added Zematus#357
Browse files Browse the repository at this point in the history
  • Loading branch information
Denormos committed Aug 9, 2023
1 parent e69b56d commit 71af9be
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Assets/Scripts/2D/InfoPanelScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ public void UpdateInfoPanel()
if (_infoTextMinimized)
return;

//Not sure if this is good and efficient code

int population = 0;
foreach(CellGroup group in world.GetAllGroups()){
population += group.Population;
}

InfoText.text += "\nTotal Population of the World: " + population;


if (Manager.CurrentWorld.SelectedCell != null)
{
AddCellDataToInfoPanel(Manager.CurrentWorld.SelectedCell);
Expand Down
5 changes: 5 additions & 0 deletions Assets/Scripts/WorldEngine/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,11 @@ public CellGroup GetGroup(Identifier id)
return group;
}

public List<CellGroup> GetAllGroups()
{
return new List<CellGroup>(_cellGroups.Values);
}

#if DEBUG
public delegate void AddGroupToUpdateCalledDelegate(string callingMethod);

Expand Down

0 comments on commit 71af9be

Please sign in to comment.