This commit is contained in:
mdecrai
2023-06-20 21:00:33 +02:00
parent ec4cda81e9
commit 772ebc64f0
130 changed files with 54030 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameManager : MonoBehaviour
{
// Array will contain objects which contain all information about all players
public PlayerManager[] playerManagers { get; private set; }
// Clock which counts seconds until new day and updates playerManagers at new day
public Clock clock;
public ScienceManager sm;
public int numberOfPlayers { get; set; }
void Awake()
{
DontDestroyOnLoad(this.gameObject);
}
// Start is called before the first frame update
void Start()
{
initPlayerManagers(1);
clock.gameManager = this;
}
// Update is called once per frame
void Update(){}
// Initializes numberOfPlayers player managers and puts them into array
public void initPlayerManagers(int numberOfPlayers)
{
this.playerManagers = new PlayerManager[numberOfPlayers];
for (int i = 0; i < numberOfPlayers; i++)
{
this.playerManagers[i] = new PlayerManager(sm);
}
}
// Updates game
public void updateGame()
{
if (playerManagers != null)
{
// Simulate day for each player
foreach (var playerManager in playerManagers)
{
playerManager.simulateDay();
}
}
// TODO update view, do we need to update view?
}
}