void Start() { mg.BuildMaze(Random.Range(1, W - 1), Random.Range(1, H - 1)); DrawMaze(); player.transform.position = GetSpawnPosition(); player.GetComponent <PlayerController>().position = player.transform.position; if (FullScreen) { Destroy(Camera.main.GetComponent <CameraController>()); Camera.main.transform.position = new Vector3Int(W / 2, H / 2, -10); Camera.main.orthographicSize = (W > H ? H : W) / 2f + 1; } else { Camera.main.orthographicSize = (W > H ? H : W) / 5f + 1; } pf = new PathFinder(); aiList = new List <GameObject>(); for (int i = 0; i < numEnemies; i++) { GameObject e = GameObject.Instantiate(ai); e.transform.position = mg.GetSpawnPosition(); aiList.Add(e); e.name = "AI"; } for (int i = 0; i < numTreasures; i++) { GameObject g = GameObject.Instantiate(treasure); g.name = "Treasure"; } }
public override void OnInspectorGUI() { // Update the serializedProperty - always do this in the beginning of OnInspectorGUI. serializedObject.Update(); EditorGUI.indentLevel = 0; EditorGUILayout.Space(); base.OnInspectorGUI(); // EditorGUILayout.PropertyField(RootProperty); // EditorGUILayout.PropertyField(StartProperty); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Clean Maze", GUILayout.ExpandWidth(false))) { _mazeGenerator.CleanMaze(); } if (GUILayout.Button("Build Layout", GUILayout.ExpandWidth(false))) { _mazeGenerator.BuildLayout(); } if (GUILayout.Button("Build Maze", GUILayout.ExpandWidth(false))) { _mazeGenerator.BuildMaze(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Clean Game", GUILayout.ExpandWidth(false))) { _mazeGenerator.CleanGame(); } if (GUILayout.Button("Build Game", GUILayout.ExpandWidth(false))) { _mazeGenerator.BuildGame(); } EditorGUILayout.EndHorizontal(); // Apply changes to the serializedProperty - always do this in the end of OnInspectorGUI. serializedObject.ApplyModifiedProperties(); }
public void startNewRound() { setUpPlayers(); if ((playedGames == 0 && !restart) || inGameJoin /*|| mazeBuildAttempts < 20*/) { mazeBuildAttempts++; mazeGenerator.DestroyMaze(); mazeGenerator.target = powerUpManager.target.gameObject; mazeGenerator.BuildMaze(); // adjust camera height Camera.main.transform.position = new Vector3(0, MazeGenerator.Instance.xSize * 4, 0); if (powerUpManager.spawnPowerUp(PowerUpManager.PowerUpTypes.Target) == null) { Debug.Log("Target not spawned"); startNewRound(); return; } inGameJoin = false; powerUpManager.setSpawnedPowerUps(0); Debug.Log("Took " + mazeBuildAttempts + " attempts to build a good maze"); mazeBuildAttempts = 0; AudioManager.Instance.stop(); AudioManager.Instance.play(AudioManager.SOUNDS.BACKTRACK1); System.Random rnd = new System.Random(); fogComes = rnd.Next(2, numGames + 2); Debug.Log("Fog comes in round " + fogComes); } else { powerUpManager.spawnPowerUp(PowerUpManager.PowerUpTypes.Target, true); } foreach (Player p in joinedPlayersToPosition.Keys) { p.gameObject.SetActive(true); } gameover = false; }