public static void Save(string path)
        {
            List <CTYPES.NOISE_LAYER> savedObject = new List <CTYPES.NOISE_LAYER>();

            foreach (NoiseLayer layer in noiseLayers)
            {
                savedObject.Add(new CTYPES.NOISE_LAYER(layer.noiseData, new CTYPES.FLOAT2(layer.seed.x, layer.seed.y), layer.seedIgnore, layer.islandMode));
            }

            SaveHandler.saveObject = savedObject;
            SaveHandler.Save(path, true);
        }
        private void PresetHandler()
        {
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("<<<"))
            {
                PrevPreset();
                GUI.FocusControl("");
            }
            GUI.skin.textField.fontStyle = FontStyle.Bold;
            presetName = EditorGUILayout.TextField("", presetName);
            GUI.skin.textField.fontStyle = FontStyle.Normal;
            if (GUILayout.Button(">>>"))
            {
                NextPreset();
                GUI.FocusControl("");
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Save"))
            {
                presetData[0] = (float)(noiseLayer.noiseData.type);
                presetData[1] = (float)(noiseLayer.noiseData.octaves);
                presetData[2] = noiseLayer.noiseData.persistence;
                presetData[3] = noiseLayer.noiseData.lacunarity;
                presetData[4] = noiseLayer.noiseData.frequency;
                presetData[5] = noiseLayer.noiseData.size;

                SaveHandler.saveObject = presetData;
                SaveHandler.Save(Paths.NoisePresets + presetName, true);

                NextPreset();
                GUI.FocusControl("");

                UpdatePresets();
            }

            if (GUILayout.Button("Delete"))
            {
                FileUtil.DeleteFileOrDirectory(Paths.NoisePresets + presetName);

                NextPreset();
                GUI.FocusControl("");
            }

            EditorGUILayout.EndHorizontal();
        }
        // ##################################################################################################################
        // ###################################### Save/Load Methods #########################################################
        // ##################################################################################################################

        public override void Save(string _path)
        {
            List <CTYPES.CHUNK_DATA> arrChunks = new List <CTYPES.CHUNK_DATA>();

            foreach (Chunk chunk in _chunks)
            {
                CTYPES.CHUNK_DATA chunkData = chunk.chunkTerrain.GetComponent <TerrainManager>().Serialize();
                arrChunks.Add(chunkData);
            }

            CTYPES.TERRAIN_DATA terrainData = new CTYPES.TERRAIN_DATA(terrainResolution, chunksX, chunksY);
            CTYPES.WORLD_STATE  state       = new CTYPES.WORLD_STATE(builded, texturized, noised, stitched, transitioned);
            CTYPES.WORLD_DATA   worldData   = new CTYPES.WORLD_DATA(terrainData, arrChunks, state);

            SaveHandler.saveObject = worldData;
            SaveHandler.Save(_path, true);
        }
Exemplo n.º 4
0
        public static void Save(string path)
        {
            foreach (GrassGenerator generator in grassGenerators)
            {
                foreach (GrassDataLayer layer in generator.grassLayers)
                {
                    layer.detailTexturePath = UnityEditor.AssetDatabase.GetAssetPath(layer.detailTexture);
                    layer.detailMeshPath    = UnityEditor.AssetDatabase.GetAssetPath(layer.detailMesh);

                    layer.details.cdryColor = new CTYPES.COLOR(layer.details.dryColor.r,
                                                               layer.details.dryColor.g,
                                                               layer.details.dryColor.b,
                                                               layer.details.dryColor.a);

                    layer.details.chealthyColor = new CTYPES.COLOR(layer.details.healthyColor.r,
                                                                   layer.details.healthyColor.g,
                                                                   layer.details.healthyColor.b,
                                                                   layer.details.healthyColor.a);
                }
            }

            SaveHandler.saveObject = grassGenerators;
            SaveHandler.Save(path, true);
        }