Ejemplo n.º 1
0
    public static void LevelFinished(bool isWon, GameSettings finishedLevel)
    {
        if (isWon)
        {
            int levelId = GS.s.GetGameModeId(finishedLevel);

            try {
                if (levelId != -1)
                {
                    if (!(levelId < s.mySave.levelsCompleted.Length))
                    {
                        bool[] temp = new bool[s.mySave.levelsCompleted.Length];
                        s.mySave.levelsCompleted.CopyTo(temp, 0);
                        s.mySave.levelsCompleted = new bool[GS.s.allModes.Length];
                        temp.CopyTo(s.mySave.levelsCompleted, 0);
                    }
                    s.mySave.levelsCompleted[levelId] = true;
                    s.Save();
                }
                else
                {
                    DataLogger.LogError("Cant complete level: " + levelId.ToString());
                }
            } catch (System.Exception e) {
                DataLogger.LogError("Cant complete level: " + levelId.ToString(), e);
            }
        }
    }