public void Initialize(IWeaponControllerSettings settings, IPoolService weaponsPool)
        {
            this.weaponsPool = weaponsPool;

            Messenger.AddListener(Signals.TargetReady(), OnStartGamePhase);
            Messenger.AddListener(Signals.AttackSucces(), ShowWeapon);
            Messenger.AddListener(Signals.TargetOut(), weaponsPool.Reset);
        }
        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);
 }
Example #4
0
 private void OnAttackSucceded()
 {
     move.Kill();
     _state = KniveState.FinishedAttack;
     Messenger.Broadcast(Signals.AttackSucces());
 }