public static void UnlockNextLevel() { if (currentCampaign == null || currentLevel == -1) { return; } campaigns[currentCampaign].UnlockLevelAfter(currentLevel); SaveLoadProgress.SaveCampaign(); }
void LoadProgress() { ProgressSave cs = SaveLoadProgress.GetGameData(); if (cs != null) { Difficulty.dLevel = cs.difficulty; } Dictionary <string, Campaign> campaigns = FreshCampaigns(); //load fresh campaigns if file doesn't exist if (cs != null) { Dictionary <string, int> d = cs.savedCampaigns.GetDictionary(); //read each saved campaign progress foreach (string str in d.Keys) { //if we don't have this campaign anymore, keep going if (!campaigns.ContainsKey(str)) { Debug.LogError("Campaign in file no longer exists!"); continue; } //set campaign progress to whatever's saved campaigns[str].spot = d[str]; } } //load campaigns into manager CampaignManager.LoadCampaigns(campaigns); //save new campaign progress file if (cs == null) { SaveLoadProgress.SaveCampaign(); } }