Britbot

Tries to determine the island target of this group from its HeadingVector.

Returns:
A SmartIsland if its probably the target or null if no island found

Definition at line 448 of file EnemyGroup.cs.

        {
            //Sort the islands by distance from this enemy group
            List<SmartIsland> sortedByDistance = SmartIsland.IslandList;
            sortedByDistance.Sort(
                (a, b) =>
                    Bot.Game.Distance(b.Loc, this.GetLocation()).CompareTo(Bot.Game.Distance(a.Loc, this.GetLocation())));

            foreach (SmartIsland isle in sortedByDistance)
            {
                //check if distance is smaller then tolerance margin
                if (Navigator.CalcDistFromLine(isle.GetLocation(), GetLocation(), this.GetHeading()) < Magic.toleranceMargin)
                    return isle;
            }

            return null;
        }