Hi,
I have pretty noob question here but can’t figure it out.
I’ve got a class with a float enemyThreat. My AI has a List of this class and calculates the threat of the enemy. Right now it only takes the distance into account.
My problem now is, that I can’t find a way to get the highest enemy with the threat.
My first intention was to check every object in the list and take its threat and make it the target. If the next object has a higher threat, it is the new target. This of course has the problem when the distance to the enemy increases again, the old, highest, threat value will still be set.
How can I calculate which value is the highest in a list, even when the overall threat gets smaller again?
Thanks for your help