Exemple #1
0
 private void OpenDemoWorld(string mapName, string templateName)
 {
     if (voxelArray == null || SelectedMap.Instance().mapName != mapName)
     {
         // create and load the file
         string filePath = WorldFiles.GetFilePath(mapName);
         if (!File.Exists(filePath))
         {
             TextAsset mapText = Resources.Load <TextAsset>(templateName);
             using (FileStream fileStream = File.Create(filePath))
             {
                 using (var sw = new StreamWriter(fileStream))
                 {
                     sw.Write(mapText.text);
                     sw.Flush();
                 }
             }
         }
         if (voxelArray != null)
         {
             voxelArray.GetComponent <EditorFile>().Save();
         }
         SelectedMap.Instance().mapName = mapName;
         SceneManager.LoadScene("editScene");
     }
     Destroy(this);
 }