public string EndGameDialog() { PlayerMeta player = BaseSaver.GetPlayer(); GameMeta game = BaseSaver.GetGame(); Unit.FactionType faction = player.faction; World world = player.world; string returnStr = "Congratulations! You have completed the campaign for faction: " + faction.ToString() + "!"; List <World> unlockedWorldsLst = new List <World>(game.unlockedWorlds); if (world != World.candy) { List <Unit.FactionType> unlockedFactionLst = new List <Unit.FactionType>(game.unlockedFactions); switch (faction) { case Unit.FactionType.Human: if (!unlockedWorldsLst.Contains(World.mountain)) { unlockedWorldsLst.Add(World.mountain); unlockedFactionLst.Add(Unit.FactionType.Egypt); returnStr += "\n\n Unlocked faction: " + Unit.FactionType.Egypt.ToString() + "!"; } break; case Unit.FactionType.Egypt: if (!unlockedWorldsLst.Contains(World.pyramid)) { unlockedWorldsLst.Add(World.pyramid); unlockedFactionLst.Add(Unit.FactionType.Cthulhu); returnStr += "\n\n Unlocked faction: " + Unit.FactionType.Cthulhu.ToString() + "!"; } break; case Unit.FactionType.Cthulhu: if (!unlockedWorldsLst.Contains(World.candy)) { unlockedWorldsLst.Add(World.candy); returnStr += "\n\n Unlocked world: " + World.candy.ToString() + "!"; } break; } game.unlockedFactions = unlockedFactionLst.ToArray(); game.unlockedWorlds = unlockedWorldsLst.ToArray(); } else { if (!unlockedWorldsLst.Contains(World.final)) { unlockedWorldsLst.Add(World.final); } returnStr += "\n\n The world has been saved! Your accomplishments have been logged in the annals history."; } BaseSaver.PutGame(game); HighScoreMeta.SaveCurrentScore(); //Reset the current save now that the factions / worlds have been unlocked and highscores saved BaseSaver.ResetAtSave(); return(returnStr); }
public static void SaveCurrentScore() { GameMeta game = BaseSaver.GetGame(); PlayerMeta player = BaseSaver.GetPlayer(); List <HighScoreMeta> hScores = new List <HighScoreMeta>(game.scores); HighScoreMeta thisScore = new HighScoreMeta(); thisScore.score = player.characters.Sum(pChar => pChar.GetLvl()); thisScore.faction = player.faction; thisScore.world = player.world; thisScore.name = "tom"; hScores.Add(thisScore); game.scores = hScores.ToArray(); BaseSaver.PutGame(game); }
void Refresh() { PrintSave("sv1", save1); PrintSave("sv2", save2); PrintSave("sv3", save3); GameMeta game = BaseSaver.GetGame(); if (game == null) { Debug.Log("Game is null"); BaseSaver.PutGame(new GameMeta()); } else { Debug.Log("Game is not null"); } }
//private float percentsPerSecond = 0.2f; //private float sceneProgress = 0; void Awake() { GameMeta game = BaseSaver.GetGame(); PlayerMeta player = BaseSaver.GetPlayer(); waiting = false; candleIdx = 0; lightIdx = 0; //lightNUM = SwitchLights(); //candleNUM = SwitchCandles(); cutsceneSnapshot = FMODUnity.RuntimeManager.CreateInstance(FMODPaths.CutsceneSnapshot); musicIntro = FMODUnity.RuntimeManager.CreateInstance(FMODPaths.MusicIntroEvent); StartCoroutine(SwitchLights()); StartCoroutine(SwitchCandles()); textHolder = new string[] { }; gameEnded = GameMeta.GameEnded(); if (!gameEnded) { List <string> txts = new List <string>(); if (!game.intro) { txts = new List <string>(StoryStatic.INTRO_STRING); game.intro = true; BaseSaver.PutGame(game); } switch (player.faction) { case Unit.FactionType.Cthulhu: txts.Add(StoryStatic.CTHULHU_INTRO); break; case Unit.FactionType.Egypt: txts.Add(StoryStatic.EGYPT_INTRO); break; case Unit.FactionType.Human: txts.Add(StoryStatic.HUMAN_INTRO); break; } textHolder = txts.ToArray(); } else { backgrounds.SetActive(false); if (player.world == GameMeta.World.tutorial) { textHolder = new string[] { "Congratulations! Tutorial completed. Good luck with the main story!" }; } else { textHolder = new string[] { game.EndGameDialog() }; if (player.world == GameMeta.World.candy) { switch (player.faction) { case Unit.FactionType.Cthulhu: textHolder = new string[] { StoryStatic.CTHULHU_WIN }; break; case Unit.FactionType.Egypt: textHolder = new string[] { StoryStatic.EGYPT_WIN }; break; case Unit.FactionType.Human: textHolder = new string[] { StoryStatic.HUMAN_WIN }; break; } } } } clickToContinue.SetActive(false); }