I'm using the Artemis-odb framework for coding game in Java (https://github.com/junkdog/artemis-odb).
I would like to instantiate some Entity (for example, buildings and people/workers). I've also seen the EntityManager class of the framework and tried to use it.
Here is my problem :
- I don't want to have a huge class extending EntityManager and having all the "create" methods because it will be an awful class --> too much lines of code, no lisibility, no thanks.
- I tried to create mutliple classes extending EntityManager, but then, each has its "nextId" value (it enables to know the id to give to the new Entity) --> I obtain mutliple entities with the same id.
- If I create multiple classes and reference only one EntityManager, I can't access to the create method of the EntityManager because this method is protected.
- An other solution I tried was to create different classes with only static methods and referencing an EntityManager. But my EntityManagers need to have non-static methods due to another reason (I spare the details).
Do you have any viable solution? There is not so much documentation for now about this framework so it's a bit complicated!
Thanks,
I respond to my question in case it an be useful to someone.
Finally, I didn't use the class EntityManager of the framework. I created several EntityManagers for what I need (buildings, workers, etc.) and make them inherit from BaseSystem. With that, I can access to them thanks to the world and do what I want.