Ejemplo n.º 1
0
    public void  TryUnlockNextLevel(int _world, int _level)
    {
        int nextLevel = _level + 1;

        if (!CheckThereIsMoreLevels(_world, nextLevel))
        {
            TryUnlockNextWorld(_world);
            return;
        }

        for (int i = 0; i < saveGameReference.levels.Count; i++)
        {
            ///if level exists forget about unlock
            if (saveGameReference.levels[i].CompareLevel(_world, nextLevel))
            {
                SetSelectedLevel(_world, nextLevel);
                return;
            }
        }

        ///if we are here the world still have levels and they are new
        FWorldLevel newLevel = new FWorldLevel(_world, nextLevel);

        saveGameReference.levels.Insert(_world, newLevel);
        saveGameReference.selectedLevel = newLevel;
    }
Ejemplo n.º 2
0
 public SaveGame()
 {
     score         = 0;
     currency      = new int[5];
     levels        = new List <FWorldLevel>();
     selectedLevel = new FWorldLevel(0, 0);
     levels.Add(selectedLevel);
     bTutorialModeCompleted = false;
     name  = "Player1";
     level = 1;
 }
Ejemplo n.º 3
0
    public void SetLevelCompleted(FWorldLevel _completedLevel)
    {
        for (int i = 0; i < saveGameReference.levels.Count; i++)
        {
            if (saveGameReference.levels[i].world == _completedLevel.world && saveGameReference.levels[i].level == _completedLevel.level)
            {
                saveGameReference.levels[i].completed = true;
                break;
            }
        }

        TryUnlockNextLevel(_completedLevel.world, _completedLevel.level);
    }