private UserEditorData CreateUserEditorData() { userData = new UserEditorData(); userData.nodesToSave = new List <Node>(); userData.decorToSave = new List <Decor>(); return(userData); }
// 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(); }
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(); }
public void ExtractUserLevel(UserEditorData recoveredData) { RebuildLevel(recoveredData.nodesToSave, recoveredData.biome, recoveredData.decorToSave); }