I was working on the uml for a game I'm currently developing and got a bit stuck thinking about how to do Unit targeting.
So to explain, currently I have a UnitManager class that has a list of Units which it updates once every frame.
I want some of the units to be able to target one of the other units if it is within a certain distance. To do this I imagine I need to get a reference to the other units in the UnitManager list and check which of them are in range in some way.
Question: How can a Unit target another Unit without having a circular dependency between Unit and UnitManager (or anywhere else)?
Thanks in advance, Vidar.
Aucun commentaire:
Enregistrer un commentaire