I'm building a targeting system where a player can double click an object and set it as the attack target.
When a target is selected, I note down the peer id.
What is should do?
If a player sets a target, the distance between the attacker and the target should be calculated in a loop.
The problem
Since both objects are of the exact same type, I can't reference them correctly in the loop.
Questions
Can I select 2 different objects inside a foreach loop?
As an example:
Pick object Player by peer id 1 as Player1
Pick object Player by peer id 2 as Player2
Calculate distance of Player1 and Player2
The code is pretty much a template multiplayer game code, the problem starts at line 71.
https://drive.google.com/open?id=1t5X1XJ9qyzOBL45pFkPP109uHURleJt8
If you can help, would be really nice.
Thank you