public bool Import(MapSaveData _msd)
        {
            if (_msd == null)
                return false;

            terrain = _msd.terrain;
            return true;
        }
Esempio n. 2
0
        public bool Import(MapSaveData _msd)
        {
            if (_msd == null)
            {
                return(false);
            }

            terrain = _msd.terrain;
            return(true);
        }
        public bool LoadMap(string path = "")
        {
            if (path == "")
            {
                path = EditorUtility.OpenFilePanel(
                    "Load Map",
                    Application.dataPath,
                    "map");
            }

            if (path.Length != 0 && File.Exists(path))
            {
                BinaryFormatter bf   = new BinaryFormatter();
                FileStream      file = File.Open(path, FileMode.Open);
                MapSaveData     msd  = (MapSaveData)bf.Deserialize(file);
                if (loadedMap == null)
                {
                    loadedMap = new Map();
                }
                loadedMap.Import(msd);
                file.Close();

                loadedMap.name = Path.GetFileNameWithoutExtension(path);

                //EditorUtility.SetDirty(this);

                // Chunk
                Chunk chunk = new Chunk();
                //chunk.Load(loadedMap, gameObject);

                // Mesh
                DrawTerrainMesh();
            }

            return(true);
        }