Exemple #1
0
 public override void OnRegister()
 {
     base.OnRegister();
     CurrentScoreChangedSignal.AddListener(View.SetCurrentScore);
     StartGameSignal.AddListener(() =>
     {
         View.SetBestScore(ScoreModel.BestScore);
     });
 }
Exemple #2
0
        public override void OnRegister()
        {
            base.OnRegister();

            StartGameSignal.AddListener(() => View.gameObject.SetActive(true));
            StopGameSignal.AddListener(() => View.gameObject.SetActive(false));

            View.OnChooseBallColor += ChoseBallColorButtonSignal.Dispatch;
        }
 public override void OnRegister()
 {
     base.OnRegister();
     StartGameSignal.AddListener(() =>
     {
         View.gameObject.SetActive(true);
     });
     StopGameSignal.AddListener(() =>
     {
         View.gameObject.SetActive(false);
     });
 }
Exemple #4
0
        private void Awake()
        {
            Signals.Get(out startGameSignal);
            Signals.Get(out gameOverSignal);
            Signals.Get(out restartLevelSignal);
            Signals.Get(out toMenuSignal);
            Signals.Get(out mortaShootSignal);
            Signals.Get(out allBulletsShotSignal);

            startGameSignal.AddListener(OnStartGame);
            gameOverSignal.AddListener(OnGameOverSignal);
            restartLevelSignal.AddListener(OnRestartLevelSignal);
            toMenuSignal.AddListener(OnToMenuSignal);
            mortaShootSignal.AddListener(OnMortaShoot);
            allBulletsShotSignal.AddListener(OnAllBulletsShot);
        }
        public void Initialize()
        {
            currentState = GameState.Menu;
            levelListAsset.ResetIndex();

            Signals.Get(out startGameSignal);
            Signals.Get(out gameOverSignal);
            Signals.Get(out toMenuSignal);
            Signals.Get(out countdownFinishedSignal);
            Signals.Get(out objectFellOffFloorSignal);
            Signals.Get(out restartLevelSignal);

            startGameSignal.AddListener(OnStartGame);
            toMenuSignal.AddListener(OnToMenu);
            countdownFinishedSignal.AddListener(OnCountdownFinishedSignal);
            objectFellOffFloorSignal.AddListener(OnObjectFellOffFloor);
            restartLevelSignal.AddListener(OnRestartLevel);
        }
Exemple #6
0
        /// <summary>
        /// On register mediator
        /// </summary>
        public override void OnRegister()
        {
            PlayGameSignal.AddListener(() =>
            {
                foreach (Transform item in View.transform)
                {
                    item.gameObject.SetActive(true);
                }

                BallsStateService.HasPaused = false;
                DOTween.TogglePauseAll();
            });

            PauseGameSignal.AddListener(() =>
            {
                BallsStateService.HasPaused = true;
                DOTween.TogglePauseAll();

                foreach (Transform item in View.transform)
                {
                    item.gameObject.SetActive(false);
                }
            });

            StartGameSignal.AddListener(() =>
            {
                BallsStateService.SpawnCount = View.SpawnCount;
                for (var i = 0; i < View.SpawnCount; i++)
                {
                    View.SpawnBall();
                }
            });

            SpawnBallsSignal.AddListener(() =>
            {
                BallsStateService.CurrentStageBallsCount = 0;
                for (var i = 0; i < View.SpawnCount; i++)
                {
                    View.SpawnBall();
                }
            });
        }