Пример #1
0
        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();
        }
Пример #2
0
        private void ExitPauseMenu()
        {
            isPaused = false;

            foreach (var selectButton in pauseMenu.GetComponentsInChildren <MenuSelectButton>())
            {
                selectButton.onClick -= SelectionButtonSelect;
            }

            if (inGame)
            {
                GamePausedEvent?.Invoke(isPaused);
            }
        }
Пример #3
0
        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;
 }
Пример #5
0
 /// <summary>
 /// invoke the event that signals the game has paused
 /// </summary>
 public static void InvokeGamePausedEvent()
 {
     GamePausedEvent.Invoke();
 }
Пример #6
0
 public static void OnGamePausedEvent()
 {
     GamePausedEvent?.Invoke();
 }