I've just started using an entity-component system for the first time and I'm having trouble making some decisions.
Currently I've got a SpriteComponent that holds a sprite, a ContentManagerComponents that holds an instance of a content manager so systems can load the content they need, and a SpriteSystem that requires both components and only has a method to set the sprite, possibly loading it beforehand (sprite rendering and animating is taken care of by other systems).
This kinda looks good, but my main concern is... how is a system that's not SpriteSystem supposed to set the sprite?
Here are my options, as I see them:
- Have systems that need to change the sprite comunicate with SpriteSystem somehow. Probably a bad idea since it introduces a dependency between systems (?).
- Move the method to set the sprite to SpriteComponent. Problem is, the method needs a content manager to load the sprite if needed.
- Get rid of ContentManagerComponent and give SpriteComponent a content manager. But the content manager doesn't only load sprites.
Any help is appreciated.