private IEnumerator GenerateMap() { this.TileMap = new Tile[this.MapSize.x, this.MapSize.z]; var activeTiles = new List <Tile> { // Spawn first tile CreateTile(this.GetRandomPosition()) }; while (activeTiles.Count > 0) { yield return(null); SpawnRemainingTiles(activeTiles); } GameManager.RebuildNavMesh(); foreach (Tile tile in this.TileMap) { yield return(null); tile.SpawnAgents(); } yield return(null); this.SpawnPlayer(); CustomCamera.CameraSystem.EnableCamera(); UIMenuNavigator.SwitchToInGameUI(); }
public void BeginGame() { // Main camera and UI is turned back on after the map is generated CustomCamera.CameraSystem.DisableCamera(); UIMenuNavigator.DisableAllUI(); Instance._playerScore = 0; if (Instance._mapOfTheDayToggle.isOn) { Random.InitState(Int32.Parse( DateTime.Now.Year + DateTime.Now.Month.ToString() + DateTime.Now.Day)); } else { Random.InitState((int)DateTime.Now.Ticks); } Instance._mapInstance = new GameObject().AddComponent <Map>(); Instance._mapInstance.name = "Map Instance"; Instance._mapInstance.MapSize = new Map.MapVector2( Instance._mapSizeXDropdown.value + 1, Instance._mapSizeYDropdown.value + 1); }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(this); } SwitchToMainMenuUI(); }
public static void EndGame() { Destroy(Instance._mapInstance.gameObject); for (int i = Instance._playerList.Count - 1; i >= 0; i--) { Destroy(Instance._playerList[i]); } Instance._playerList.Clear(); Instance._enemyList.Clear(); UIMenuNavigator.SwitchToPostGameUI(); StatsWindow.UpdateStats(); }