public void TextureListItemSelected(ItemSelectionActionData itemSelectData) { string text = itemSelectData.ItemView.Text; int index = 0; switch (text) { case "Sand": index = 0; break; case "Grass": index = 1; break; case "Mud": index = 3; break; case "Stone": index = 2; break; case "Snow": index = 4; break; } _hexMapEditor.SetTerrainTypeIndex(index); _terrainTypeIndex = index; Debug.Log("SetTerrainTypeIndex " + index); }
public IEnumerator chooseAndSetTerrainTest() { 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 terrainTypeIndex = 1; editor.SetTerrainTypeIndex(terrainTypeIndex); editor.HandleTestInput(cell); Assert.AreEqual(terrainTypeIndex, editor.activeTerrainTypeIndex); foreach (GameObject g in go) { GameObject.Destroy(g); } SceneManager.UnloadScene("Scene"); }
private static void TerrainCommands(string command) { int val = 0; if (int.TryParse(command, out val)) { editor.SetTerrainTypeIndex(val); } else { Debug.Log("Console Command Failure Terrain"); } }