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(); }
/// <summary>Handles the GamePausedEvent event.</summary> /// <param name="message">The message.</param> public void Handle(GamePausedEvent message) { if (!message.Get()) { menu = Visibility.Visible; } else { menu = Visibility.Hidden; } }
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); }
/// <summary> /// invoke the event that signals the game has paused /// </summary> public static void InvokeGamePausedEvent() { GamePausedEvent.Invoke(); }
void OnGamePausedEvent(GamePausedEvent e) { Time.timeScale = 0; paused = !paused; }
public static void OnGamePausedEvent() { GamePausedEvent?.Invoke(); }
void OnGamePausedEvent(GamePausedEvent e) { PauseOverlay.SetActive(true); currentOverlay = PauseOverlay; pauseScore.SetText(FillScoreWithZeros(GameScore.Score.ToString())); }