Пример #1
0
    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);
    }
Пример #2
0
    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);
    }
Пример #3
0
 // Start is called before the first frame update
 public void ResetSave()
 {
     HighScoreMeta.SaveCurrentScore();
     BaseSaver.ResetAtSave();
     SceneManager.LoadScene("MainScene");
 }