示例#1
0
 public void RestartLevel(bool reset = true)
 {
     if (currentLevel.respawnLocked)
     {
         return;
     }
     SignalManager.BeginReset();
     currentCheckpointNumber        = 0;
     currentCheckpointSubObjectives = 0;
     if (currentLevel.prerespawn != null)
     {
         currentLevel.prerespawn(-1, startingLevel: false);
     }
     RespawnAllPlayers();
     if (reset)
     {
         currentLevel.Reset(currentCheckpointNumber, currentCheckpointSubObjectives);
         if (NetGame.isServer)
         {
             NetSceneManager.ResetLevel(currentCheckpointNumber, currentCheckpointSubObjectives);
         }
     }
     currentLevel.BeginLevel();
     SignalManager.EndReset();
     if (reset)
     {
         currentLevel.PostEndReset(currentCheckpointNumber);
     }
 }
示例#2
0
 public void RestartCheckpoint(int checkpointNumber, int subObjectives)
 {
     if (!currentLevel.respawnLocked)
     {
         currentCheckpointNumber        = Mathf.Min(checkpointNumber, currentLevel.checkpoints.Length - 1);
         currentCheckpointSubObjectives = subObjectives;
         SignalManager.BeginReset();
         if (currentLevel.prerespawn != null)
         {
             currentLevel.prerespawn(checkpointNumber, startingLevel: false);
         }
         RespawnAllPlayers();
         currentLevel.Reset(currentCheckpointNumber, currentCheckpointSubObjectives);
         if (NetGame.isServer)
         {
             NetSceneManager.ResetLevel(currentCheckpointNumber, currentCheckpointSubObjectives);
         }
         currentLevel.BeginLevel();
         CheckpointLoaded(currentCheckpointNumber);
         SignalManager.EndReset();
         currentLevel.PostEndReset(currentCheckpointNumber);
     }
 }