There needs to be a way for Module to access their actors position. Consider some different approaches, and implement the best suited one.
Some options:
- Public method in
Actor that gets the position from the World it's contained in.
- Making the
_world field public.
Considering that I would like to change World into not having positions stored, and instead have a subclass for positioning, the following are the drawbacks of each approach:
- Public method in
Actor that gets the position from the World it's contained in: Having tight coupling wouldn't work, as not every Actor would be in a world with positions for its actors.
- Making the
_world field public: I believe this would only cause issues within a Module if the referenced world doesn't cast to a world subclass with positioning.
Both of these approaches could be fixed by making a subclass of Actor, and implementing one of the suggested approaches. Might be an idea to also create a subclass of Module in this case.
There needs to be a way for
Moduleto access their actors position. Consider some different approaches, and implement the best suited one.Some options:
Actorthat gets the position from theWorldit's contained in._worldfield public.Considering that I would like to change
Worldinto not having positions stored, and instead have a subclass for positioning, the following are the drawbacks of each approach:Actorthat gets the position from theWorldit's contained in: Having tight coupling wouldn't work, as not everyActorwould be in a world with positions for its actors._worldfield public: I believe this would only cause issues within aModuleif the referenced world doesn't cast to a world subclass with positioning.Both of these approaches could be fixed by making a subclass of
Actor, and implementing one of the suggested approaches. Might be an idea to also create a subclass ofModulein this case.