Exemplo n.º 1
0
 private UserEditorData CreateUserEditorData()
 {
     userData             = new UserEditorData();
     userData.nodesToSave = new List <Node>();
     userData.decorToSave = new List <Decor>();
     return(userData);
 }
Exemplo n.º 2
0
        // called from SaveAndLoad manager
        public void PlayCommunityLevel(string levelName)
        {
            string folder    = Application.persistentDataPath + "/CommunityLevels";
            string levelFile = levelName + ".json";
            string path      = Path.Combine(folder, levelFile);

            Debug.Log("Path to level is " + path);

            if (File.Exists(path))
            {
                Debug.Log("Foud the file");
                string         json      = File.ReadAllText(path);
                UserEditorData levelData = JsonUtility.FromJson <UserEditorData>(json);

                ExtractUserLevel(levelData);
                Debug.Log("Finished Building the Level bruh");
            }

            userData.nodesToSave.Clear();
            activeNodes.Clear();
        }
Exemplo n.º 3
0
        public void UserLoadLevel(string levelName)
        {
            string folder    = Application.persistentDataPath + "/UserLevels";
            string levelFile = levelName + ".json";
            string path      = Path.Combine(folder, levelFile);

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

                ExtractUserLevel(userData);
            }

            currentOpenLevelName    = userData.levelName;
            currentDifficltySetting = userData.creatorDifficulty;
            currentBiome            = userData.biome;

            userData.nodesToSave.Clear();
            activeNodes.Clear();
        }
Exemplo n.º 4
0
 public void ExtractUserLevel(UserEditorData recoveredData)
 {
     RebuildLevel(recoveredData.nodesToSave, recoveredData.biome, recoveredData.decorToSave);
 }