/// <summary> /// The IMinionAttacker attacker attacks target Minion, iff the attacker is idle, thsus not moving or already attacking someone /// </summary> /// <param name="attacker"></param> /// <param name="target"></param> public void AutoAttackMinion(IMinionAttacker attacker, Minion target) { if (attacker.Allegiance != target.Allegiance) { attacker.AutoAttackMinion(target); } }
/// <summary> /// Goes through the according viewlist and checks if there is a Minion that is in range. /// If there is a minion in range, the gameObject will attack the Minion. /// </summary> /// <param name="attacker"></param> private void AttackNearbyMinions(IMinionAttacker attacker) { if (attacker.Allegiance == Allegiance.Player) { foreach (GameObject unit in mPlayerView) { if (unit is Minion && InRange(attacker, unit)) mGameObjectManager.AutoAttackMinion(attacker, (Minion)unit); } } else if (attacker.Allegiance == Allegiance.Computer) { foreach (GameObject unit in mComputerView) { if (unit is Minion && InRange(attacker, unit)) mGameObjectManager.AutoAttackMinion(attacker, (Minion)unit); } } }