Esempio n. 1
0
 private DevEditorData CreateDevEditorData()
 {
     devData             = new DevEditorData();
     devData.nodesToSave = new List <Node>();
     devData.decorToSave = new List <Decor>();
     return(devData);
 }
Esempio n. 2
0
        public void DevLoadLevel(string levelName, Biomes biome)
        {
            string folder      = Application.dataPath + "/Resources/MainLevels";
            string levelFile   = levelName + ".json";
            string levelFolder = GetLevelFolder(biome);

            string path = Path.Combine(folder, levelFolder, levelFile);

            if (File.Exists(path))
            {
                string json = File.ReadAllText(path);
                devData = JsonUtility.FromJson <DevEditorData>(json);

                ExtractGameLevel(devData);
            }

            currentOpenLevelName   = devData.levelName;
            currentKubicode        = devData.Kubicode;
            currentBiome           = devData.biome;
            currentLevelLockRotate = devData.lockRotate;
            currentMinimumMoves    = devData.minimumMoves;

            devData.nodesToSave.Clear();
            activeNodes.Clear();
        }
        // use this function to extract information from text file asset and into a LevelFile
        public static LevelFile ConvertToLevelInfo(TextAsset levelFile)
        {
            LevelFile levelInfo = new LevelFile();

            DevEditorData levelData = JsonUtility.FromJson <DevEditorData>(levelFile.ToString());

            levelInfo.levelFile    = levelFile;
            levelInfo.levelName    = levelData.levelName;
            levelInfo.levelBiome   = levelData.biome;
            levelInfo.kubicode     = levelData.Kubicode;
            levelInfo.minimumMoves = levelData.minimumMoves;
            levelInfo.lockRotate   = levelData.lockRotate;

            return(levelInfo);
        }
Esempio n. 4
0
 public void ExtractGameLevel(DevEditorData recoveredData)
 {
     RebuildLevel(recoveredData.nodesToSave, recoveredData.biome, recoveredData.decorToSave);
 }