public void SetIsPaused(bool paused) { if (isPaused == paused) { return; } if (pauseObjects.GetSet() != null) { if (pauseObjects.GetSet().Count > 0) { foreach (GameObject go in pauseObjects.GetSet()) { go.SetActive(!paused); } } } Time.timeScale = paused ? 0f : 1f; isPaused = paused; if (isPaused && OnPaused != null) { OnPaused.Invoke(); } if (!isPaused && OnUnpaused != null) { OnUnpaused.Invoke(); } }
public void SetAllSpawnersSpawning(bool shouldSpawn) { foreach (GameObject spawnerObj in spawnerSet.GetSet()) { PropSpawner spawnerComponent = spawnerObj.GetComponent <PropSpawner>(); spawnerComponent.SetSpawning(shouldSpawn); } }