Hello you should consider using the dot product to compute the angle between two vectors.
- A is the vector from the tower to the max distance point aligned with the first enemy.
- B is the vector from the tower to the enemy to test (one of the enemies list).
θ = acos( (A . B) / (|A| |B|) )
Thus if θ is equal or close to 0° then they are parallels and in the same direction.
You could also consider using the cross product, but it's fit better for 3D.
One of the use of the cross product is to determine if two vectors are parallels by checking whether the resulting vector is close to the zero vector, you can determine which enemies in your enemies list are aligned on the same vector as your first targeted enemy. It normally does apply to 3D vectors only, but as far as I remember you can use it with 2D vectors using a 0 value as Z value. (Take care they can be parallels and in opposite direction, ie: in the opposite side of the tower direction. You can use crossproduct to determine if they are the same direction)
Still considering the same A and B as in the dot product part:
A x B = [Ax, Ay, Az] x [Bx,
A x B = [Ay*Bz - Az*By , Az*Bx -
Ax*Bz , Ax*By - Ay*Bx ]
If this result vector is equal to (or "close to", depending of you needs) [0,0,0] then they should be parallels. then compute the dot product to verify if they are the same direction.
Finally, could also consider computing the distance between the segment (from tower position to the max radius using the first enemy direction) and the point (your current enemies list) : http://paulbourke.net/geometry/pointline/, or the distance from a point to a plane if you use 3D and flying enemies on top of grounded ones.
Using the above techniques (distance from a point to a plan/segment), you should also consider previously reducing the number of enemies in your current enemies table using a simple vector dot product (the vector from the tower to the max distance in the first enemy direction, dot-product the vector from the tower to the enemy to test). If your dot product is greater than 0 they point to the "same direction", if it is equal to 0 the vectors are perpendiculars and if the dot product is lower than 0, the vectors are in "opposite" directions. This way you can reduce the number of enemies to consider by keeping only those in the front direction... I beg this is useful only with a huge number of enemies, so it's up to you to decide if it worth it or not.
Edited: to reorganize the ideas...
I beg your pardon if this is not clear enough, as I'm not really fluent at English, it could be unclear... so if I'm not I will try to reformulate.