public GameUIController(GameUIView view, GamePersistentData data) { mView = view ?? throw new ArgumentNullException("view"); mPersistentData = data ?? throw new ArgumentNullException("data"); EventBus.OnBaseHealthChanged += _onHealthChanged; EventBus.OnEnemyDestroyed += _onEnemyDestroyed; EventBus.OnNewWaveIsComing += _onNewWaveIsComming; EventBus.OnNewTurretWasCreated += _onNewTurretWasCreated; _updateAvailableTurretsUIList(mPersistentData.mTurrets); mView.ScoreValue = mPersistentData.mCurrScore; mView.OnPauseGameButtonClicked += _onPauseGameTime; mView.OnNormalTimeGameButtonClicked += _onSetNormalGameTime; mView.OnSpeedUpGameButtonClicked += _onSpeedUpGameTime; }
/// <summary> /// Attatches the GUI to the current game /// </summary> /// <param name="gameUIView">The GUI that implements the GameUIView</param> public void AttatchView(GameUIView gameUIView) { this.gameUIView = gameUIView; gameUIView.UpdateQuestion(GenerateQuestion()); }