Original Post
Hello forum, i'm trying to figure out the best way of having all my rts-like units to interact with eachother, but i'm not sure how to do it.
My idea is as follows:
Unit class: with all the AI built into it.
UnitHandler class(drawable game component): which holds all units and retrieves data from Unit "X" for unit "Y" to use.
The problem is, i'm not sure if this is the right approach, or if the Unit Class should be a nested class of UnitHandler (in order to get/set the data in a more elegant way)
On top of that, i already have AI code Built into Unit, so i dont want to migrate all the code to UnitHandler if i dont have to.
My idea is as follows:
Unit class: with all the AI built into it.
UnitHandler class(drawable game component): which holds all units and retrieves data from Unit "X" for unit "Y" to use.
The problem is, i'm not sure if this is the right approach, or if the Unit Class should be a nested class of UnitHandler (in order to get/set the data in a more elegant way)
On top of that, i already have AI code Built into Unit, so i dont want to migrate all the code to UnitHandler if i dont have to.