Esempio n. 1
0
 /// <summary>
 /// Reloads the current level.
 /// withLastCheckpoint indicates If any checkpoint exists in previous part of current level, should we load the checkpoint ?
 /// </summary>
 void ReloadCurrentLevel(bool withLastCheckpoint)
 {
     //if withLastCheckpoint = true, load current level with checkpoint
     if (withLastCheckpoint)
     {
         //check if there's checkpoint , and if the checkpoint level = current level
         string lastCheckPointLevel = "";
         string lastCheckPointName  = "";
         bool   hasCheckPoint       = checkPointManager.GetLastCheckpoint(out lastCheckPointLevel, out lastCheckPointName);
         //if has checkpoint and the checkpoint level = this level
         if (hasCheckPoint && lastCheckPointLevel == Application.loadedLevelName)
         {
             ContinueLastCheckpoint();
         }
         else
         {
             LoadLevelByNumber(Application.loadedLevel);
         }
     }
     else
     //simply reload the current level
     {
         LoadLevelByNumber(Application.loadedLevel);
     }
 }