Пример #1
0
        private void OnAttackFaied()
        {
            move.Kill();

            _view.FailedAnimation();

            _state = KniveState.FinishedAttack;

            Messenger.Broadcast(Signals.AttackFailed());
        }
        private void StartGame(int stage = 0)
        {
            _stage = stage;
            _numberOfValidTries = 0;
            NumberOfTries       = 0;
            int triesIndex = Mathf.Clamp(_stage, 0, Settings.TriesModels.Length - 1);
            IGameControllerTriesModel triesModel = Settings.TriesModels[triesIndex];

            MaxNumberOfTries = Random.Range(triesModel.Tries, triesModel.Tries + triesModel.TriesRange);

            Messenger.AddListener(Signals.StartAttack(), UpdateTries);
            Messenger.AddListener(Signals.AttackSucces(), AttackSuccesHandler);
            Messenger.AddListener(Signals.AttackFailed(), AttackFailedHandler);

            GameStartModel model = new GameStartModel(RemainingTries);

            Messenger.Broadcast <IGameStartModel>(Signals.UpdateAttackTries(), model);
            Messenger.Broadcast(Signals.GameStartPhase());
        }
 private void EndGame()
 {
     Messenger.RemoveListener(Signals.StartAttack(), UpdateTries);
     Messenger.RemoveListener(Signals.AttackSucces(), AttackSuccesHandler);
     Messenger.RemoveListener(Signals.AttackFailed(), AttackFailedHandler);
 }