public IEnumerator chooseAndSetUrbanLevelTest() { SceneManager.LoadScene("Scene", LoadSceneMode.Single); yield return(new WaitForSeconds(1.0f)); GameObject[] go = SceneManager.GetActiveScene().GetRootGameObjects(); HexMapEditor editor = go[3].transform.Find("Hex Map Editor").GetComponent <HexMapEditor>(); HexGrid grid = go[1].gameObject.GetComponent <HexGrid>(); HexGridChunk[] chunks = grid.getHexGridChunks(); HexCell[] cells = chunks[0].getCells(); HexDirection direction = HexDirection.NE; HexCell cell = cells[4].GetNeighbor(direction).GetNeighbor(direction) .GetNeighbor(direction); int urbanLevel = 1; editor.SetApplyUrbanLevel(true); editor.SetUrbanLevel(urbanLevel); editor.HandleTestInput(cell); Assert.AreEqual(urbanLevel, editor.activeUrbanLevel); foreach (GameObject g in go) { GameObject.Destroy(g); } SceneManager.UnloadScene("Scene"); }
private static void DensityCommands(string command) { int val = 0; if (command.Equals("Active")) { editor.SetApplyUrbanLevel(true); return; } if (command.Equals("Inactive")) { editor.SetApplyUrbanLevel(false); return; } if (int.TryParse(command, out val)) { editor.SetUrbanLevel(val); } else { Debug.Log("Console Command Failure"); } }
public void UrbanLevelValueChanged() { _hexMapEditor.SetUrbanLevel(UrbanLevel.Value); }