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); } }
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); } }
public void EnterCheckpoint(int checkpoint, int subObjectives) { if (state != GameState.PlayingLevel) { return; } bool flag = false; if (currentCheckpointNumber < checkpoint) { flag = true; } else if (currentLevel.nonLinearCheckpoints && currentCheckpointNumber != checkpoint) { flag = true; } else if (currentCheckpointNumber == checkpoint && subObjectives != 0) { flag = true; } if (!flag) { return; } Debug.Log("Passed " + checkpoint + ", subobjectives: " + subObjectives); int num = currentCheckpointNumber; int num2 = currentCheckpointSubObjectives; if (currentCheckpointNumber != checkpoint) { currentCheckpointSubObjectives = 0; } if (subObjectives != 0) { currentCheckpointSubObjectives |= 1 << subObjectives - 1; } currentCheckpointNumber = checkpoint; if (workshopLevel == null && currentLevelNumber != -1) { if (NetGame.isLocal) { WorkshopItemSource workshopItemSource = currentLevelType; if (workshopItemSource == WorkshopItemSource.EditorPick) { GameSave.PassCheckpointEditorPick((uint)currentLevelNumber, checkpoint, currentCheckpointSubObjectives); } else { GameSave.PassCheckpointCampaign((uint)currentLevelNumber, checkpoint, currentCheckpointSubObjectives); } } if (num != currentCheckpointNumber || num2 != currentCheckpointSubObjectives) { SubtitleManager.instance.SetProgress(ScriptLocalization.TUTORIAL.SAVING, 1f, 1f); } } else { if (NetGame.isLocal) { GameSave.PassCheckpointWorkshop(workshopLevel.hash, checkpoint); } SubtitleManager.instance.SetProgress(ScriptLocalization.TUTORIAL.SAVING, 1f, 1f); } if (NetGame.isServer) { NetSceneManager.EnterCheckpoint(checkpoint, subObjectives); } }