public void Initialize(ITargetControllerSettings settings) { _settings = settings; _currentSettingsModel = 0; transform.position = _settings.Position; _view.Hide(); Messenger.AddListener(Signals.GameStartPhase(), OnGameStart); Messenger.AddListener <bool>(Signals.GameResultPhase(), OnGameResultPhase); Messenger.AddListener <IGameResultModel>(Signals.GameResult(), OnGameResult); }
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()); }