I have some problems making targeting system. I`m trying to make targeting system that can switch between targets by pressing some buttons on controller. When player select weapon with this system it marks nearest enemy, then when target switch buttons are pressed targeting mark moves on second nearest enemy and so on. Also, weapon have limited range so targeting system should not work when enemy is out of weapon`s range.
1) Is there any way to set this up for each object in some kind of group, for family ?Enemy? for example (there will be 4-5 types of enemies and they will spawn in random order and in the same time)?
2) How can I program targeting mark behavior (show when enemy in range, hide/destroy when enemy out of range, switch between targets from nearest to farthest when distance between player and enemies will constantly change in both directions)?
I`m almost in despair and will be very grateful for any help.