public Minion SelectEnemy(EnemyAttacker tower, List <Minion> minions)
        {
            int    strongestHealth = int.MinValue;
            Minion strongest       = null;

            foreach (Minion minion in minions)
            {
                double distance = GameUtils.CalculateDistance(tower.Position, minion.Position);
                if (distance < tower.Range && minion.Health > strongestHealth)
                {
                    strongestHealth = minion.Health;
                    strongest       = minion;
                }
            }
            return(strongest);
        }
Esempio n. 2
0
        public Minion SelectEnemy(EnemyAttacker tower, List <Minion> minions)
        {
            double furthestDistance = double.MinValue;
            Minion furthest         = null;

            foreach (Minion minion in minions)
            {
                double distance = GameUtils.CalculateDistance(tower.Position, minion.Position);
                if (distance < tower.Range && distance > furthestDistance)
                {
                    furthestDistance = distance;
                    furthest         = minion;
                }
            }
            return(furthest);
        }