public void Think() { if (_updateTimer > _data.TimeBetweenAttacks) { _updateTimer = 0; _attacker.Attack(_data, Vector3.zero); } _updateTimer += Time.deltaTime; }
public ActionResult AttemptAttack(ApiVersion version, [FromBody] AttackModel model) { try { var status = _attacker.Attack(model.Board, model.Row, model.Column); return(Ok(status)); } catch (Exception e) { Console.WriteLine(e); throw; } }
public void Tick() { _currentAttackTime += Time.deltaTime; if (_currentAttackTime > _maxAttackTime) { _flip.FlipCharacter(_isPlayerRightSide.Invoke()? 1f : -1f); _animation.AttackAnimation(); //Attack Voice _attacker.Attack(_playerHealth); _currentAttackTime = 0f; } }
private void ExecuteAttack(IAttacker attacker, Guid targetId) { var target = State.FindObject(targetId); if (!IsAdjacent((Unit)attacker, target)) { throw new BadActionException($"Unit {attacker} not adjacent to intended target of attack {target}"); } attacker.Attack(); target.TakeDamage(attacker.AttackLevel); if (target.ShouldRemove()) { State.Destroy(target); //unit.Stats.AddStat(killed the target) } }
public void OnAttack(IAttacker attacker, ITargetable defender) { AttackBattleAction action = attacker.Attack(defender); AttackBattleAction counterAction = null; if ((action.Type & AttackBattleAction.DamageType.CanBeCounter) != 0) { ITargetable a = attacker as ITargetable; if (a != null) { counterAction = defender.Counter(a); } } action.Execute(); if (counterAction != null) { counterAction.Execute(); } attacker.DeathCheck(); defender.DeathCheck(); }
public string Attack(string[] args) { string attackerName = args[0]; string receiverName = args[1]; Character attacker = characters.FirstOrDefault(ch => ch.Name == attackerName); Character receiver = characters.FirstOrDefault(ch => ch.Name == receiverName); if (attacker == null) { throw new ArgumentException($"Character {attackerName} not found!"); } if (receiver == null) { throw new ArgumentException($"Character {receiverName} not found!"); } if (attacker.GetType().Name != nameof(Warrior)) { throw new ArgumentException($"{attacker.Name} cannot attack!"); } IAttacker castedAttacker = (IAttacker)attacker; castedAttacker.Attack(receiver); StringBuilder sb = new StringBuilder(); sb.AppendLine($"{attackerName} attacks {receiverName} for {attacker.AbilityPoints} hit points! {receiverName} has {receiver.Health}/{receiver.BaseHealth} HP and {receiver.Armor}/{receiver.BaseArmor} AP left!"); if (receiver.Health <= 0) { sb.AppendLine($"{receiver.Name} is dead!"); } return(sb.ToString().Trim()); }
public void Execute() { attacker.Attack(); }
//public void CallAttack<T>() where T : IAttacker public void CallAttack() { _attacker.Attack(); //_attackerList.Find(item => item is T)?.Attack(); }
public void Attack(InputValue btn) => attackController?.Attack(btn);