I’m currently trying to implement an aggro system at the moment but the process seems very messy, I would like to know if this is the proper approach. This is a RTS system.
In one instance:
-There are 4 different transforms under “Player” tag and 20 under “Enemy” tag. The two “parties” will attack each other.
-Every time a transform is hit, it will record the transform, be it name or objectID and add to an int called aggroLevel. This is where I feel like using objectID would come in handy since I can just make it an array of 2.
int [ ] aggro = new int{objectID,aggroLevel}
How would I approach this if I didn’t use the same type of variable in a clean way?
-I will use a List to easily check if it contains the objectID already and then add +5 to aggro[1] by iterating through a list using a standard i++ loop.
The part in red text is what I’m concerned with. The good thing is that I can run this command only when a target takes damage or at an interval if I wish, the bad is that it’s iterating everytime a target takes damage in the scene.