Example #1
0
    private void OnWizardCreate()
    {
        TerrainEditor.ClearUndoRedoStack();

        if (TerrainEditor.TerrainParent.transform != null)
        {
            foreach (Transform child in TerrainEditor.TerrainParent.transform)
            {
                DestroyImmediate(child.gameObject);
            }
        }

        TerrainEditor.terrainName = mapName;
        HexGrid.instance.ChangeSize(chunkCountX, chunkCountZ);
        HexMetrics.instance.isEditorTexture = isUseTexture;
        HexGrid.instance.isLoadPrefab       = false;
        HexGrid.instance.NewMap(mapName, true, defaultTerrainTexs, chunkWidth, chunkHeight);

        if (TerrainEditor.TerrainParent != null)
        {
            for (int i = 0; i < HexGrid.instance.maps.Length; i++)
            {
                HexGrid.instance.maps[i].transform.SetParent(TerrainEditor.TerrainParent.transform);
            }

            if (isSaveAfterCreate)
            {
                TerrainEditor.SaveHexChunkAsset(mapName);
            }
        }
    }
Example #2
0
    private void OnWizardCreate()
    {
        if (mapName.Count > selectIndex)
        {
            TerrainEditor.ClearUndoRedoStack();

            if (TerrainEditor.TerrainParent.transform != null)
            {
                foreach (Transform child in TerrainEditor.TerrainParent.transform)
                {
                    DestroyImmediate(child.gameObject);
                }
            }

            HexGrid.instance.isLoadPrefab = true;
            TerrainEditor.LoadMapAsset(mapName[selectIndex]);
        }
    }