Beispiel #1
0
 public void SaveLastPlayedLevel()
 {
     // Check if current level is farthest level played before saving
     if (levelHandler.GetPackIndex(levelHandler.CurrentPack.packId) >= levelHandler.GetPackIndex(playerData.GetLastPlayedPack()) &&
         levelHandler.GetLevelIndex(levelHandler.CurrentPack.packId, levelHandler.CurrentLevel.levelName) >=
         levelHandler.GetLevelIndex(playerData.GetLastPlayedPack(), playerData.GetLastPlayedLevel()))
     {
         Debug.Log("Saving LastPlayedLevel");
         //
         if (GetCurrentPack().levelList.Count > GetCurrentLevel().levelNumber + 1)
         {
             playerData.SaveLastPlayedLevel(GetCurrentPack(), GetCurrentPack().levelList[GetCurrentLevel().levelNumber + 1]);
         }
         else if (levelHandler.GetPackList().NextPack(GetCurrentPack()) != null)
         {
             playerData.SaveLastPlayedLevel(levelHandler.GetPackList().NextPack(GetCurrentPack()), levelHandler.GetPackList().NextPack(GetCurrentPack()).levelList[0]);
         }
         //playerData.SaveLastPlayedLevel(levelHandler.CurrentPack., levelHandler.CurrentLevel);
     }
 }