public void Init(IMovementData movementData, IAttackHandler attackHandler, IDamageHanalder damageHanalder, IDefenseHandler defenseHandler) { MovementData = movementData; AttackHandler = attackHandler; AttackHandler.OnAttack += Attack; AttackHandler.PunchStateChange += OnPunchStateChange; MovementData.OnDashStateChanged += DashStateChanged; MovementData.OnJump += OnJump; MovementData.OnLand += OnLand; DamageHanalder = damageHanalder; DamageHanalder.OnDamage += OnPlayerHit; DefenseHandler = defenseHandler; DefenseHandler.DefenseStarted += OnDefense; }
private void Awake() { _stats = GetComponent <StatsBehaviour>(); _attackInvoker = GetComponent <IAttackHandler>(); _avoidTarget = GetComponent <IDamagable>(); _attackInvoker.OnAttackTrigger += HandleAttack; _attackInvoker.OnAttackCancel += AttackCancel; PlayerHealthBehaviour.OnPlayerDeath += () => _nextAttackTime = float.PositiveInfinity; if (!_projectilePool) { _projectilePool = GameObject.FindGameObjectWithTag("EnemyProjectilesPool").GetComponent <ProjectilePool>(); } foreach (Turret turret in GetComponentsInChildren <Turret>()) { _turrets.Add(turret); } }
public Game(IContainer container, IGameMessages messages, IAttackHandler actionHandler, IRandomNumberGenerator randomNumberGenerator) { Container = container; this.GameMessages = messages; this._actionHandler = actionHandler; this._randomNumberGenerator = randomNumberGenerator; Interlocked.Increment(ref _counter); _gameId = _counter; }
public void Init(IDamageHanalder damageHanalder, IDefenseHandler defenseHandler, IAttackHandler attackHandler) { _damageHanalder = damageHanalder; _defenseHandler = defenseHandler; _attackHandler = attackHandler; }