Exemple #1
0
        public UIController(InputModel inputModel, PointModel pointModel,
                            EnemyPool enemyPool, PauseModel pauseModel)
        {
            _controllers = new ControllerList();

            _pause = inputModel.Pause();
            _pause.OnKeyPressed += OnPauseKeyPressed;

            _pointModel = pointModel;
            _pointModel.OnPointsChanged += OnPointsChanged;

            _enemyPool = enemyPool;
            _enemyPool.OnEnemyKilledAndReturned += OnEnemyKilled;

            _lastEnemyKilledPanelController = new LastEnemyKilledPanelController();
            _scorePanelController           = new ScorePanelController();
            _pausePanelController           = new PausePanelController(pauseModel);
            _nullPanelController            = new NullPanelController();

            _controllers.Add(_pausePanelController);

            _scorePanelController.SetText("0");
            _pausePanelController.Close();
            _pausePanelController.OnResumeButtonPressed += ChangePanelController;

            _currentPanelController = _nullPanelController;

            _controllers.Initialize();
        }
Exemple #2
0
        public PausePanelController(PauseModel pauseModel)
        {
            _view = Object.FindObjectOfType <PausePanel>();

            _resumeButton = _view.ResumeButton;
            _exitButton   = _view.ExitButton;
            _tweenTime    = _view.TweenTime;

            _elementTweens = new ISidePanelElementTween[]
            {
                new SidePanelTween(_view.RectTransform, _tweenTime),
            };

            _pauseModel      = pauseModel;
            ReadyToPause    += _pauseModel.Pause;
            OnPanelSwitched += _pauseModel.PausePanelSwitched;
            _resumeButton.onClick.AddListener(Resume);
            _exitButton.onClick.AddListener(Exit);
        }