> For the complete documentation index, see [llms.txt](https://steijn.gitbook.io/devlogs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://steijn.gitbook.io/devlogs/blewscreen/rezone/gamemanager.md).

# GameManager

## Planning

To begin with the "GameManager", I looked at what we needed it to accomplish. It needed to control all different zones, while also being a centralized location for the game’s settings.

It also needed to acknowledge when the game is finished and what the results were, causing it to be displayed on the end screen UI.

### Starting off

First, I started with the different zones. The health needed to be randomised as well as the doomed state. Further, there is the status of the zones, which varies between destroyed, ongoing and saved.

After discussing with my coworker who was going to make the zones, we settled on using an Enum for the status and that the "GameManager" would generate the starting healths and doomed zones.

```csharp
 public void SetdoomedZone() 
    {     //new list so i can remove to prevent overlap 
        List<Zone> tempZones = ZoneList; 
        for (int i = 0; i < 2; i++) 
        {//roll two random zones without overlapping 
            int roll = Random.Range(0, tempZones.Count); 
            tempZones[roll].doomedZone = true; 
            tempZones.RemoveAt(roll); 
        } 

```
