public void Pause() { #region Validation if (this._status != GameStatus.InProgress) { throw new InvalidOperationException("Only game with status 'InProgress' can be paused"); } #endregion /* * Review GY: рекомендую проставити фігурні дужки для оператора if */ if (GamePausedEvent == null) { throw new NullReferenceException(); } this._status = GameStatus.Paused; /* * Review GY: метод Invoke викликається автоматично. * Викликати його явно не потрібно. */ GamePausedEvent.Invoke(); }
private void ExitPauseMenu() { isPaused = false; foreach (var selectButton in pauseMenu.GetComponentsInChildren <MenuSelectButton>()) { selectButton.onClick -= SelectionButtonSelect; } if (inGame) { GamePausedEvent?.Invoke(isPaused); } }
private IEnumerator FindPauseMenu() { Logger.Instance.Log("Finding Pause Menu", Logger.LogSeverity.DEBUG); while (pauseMenu == null) { pauseMenu = FindObjectOfType <PauseMenu>(); yield return(null); } foreach (var button in menu.GetComponentsInChildren <MenuSelectButton>()) { button.onClick += SelectionButtonSelect; } isPaused = true; PauseMenuReadyEvent?.Invoke(pauseMenu); GamePausedEvent?.Invoke(isPaused); }
public void Pause() { onGamePaused?.Invoke(); Time.timeScale = 0; }
/// <summary> /// invoke the event that signals the game has paused /// </summary> public static void InvokeGamePausedEvent() { GamePausedEvent.Invoke(); }
public static void OnGamePausedEvent() { GamePausedEvent?.Invoke(); }