hey,
I am working for the first time with artemis-odb and don´t get how/when Systems are injected into other Systems.
The Wiki says that they are at the beginning added but I get always an Nullpointer.
void create(){
WorldConfiguration builder = new WorldConfigurationBuilder()
.with(new CameraSystem(1920, 1080, 1), new MapSystem(), new MapRenderSystem())
.build();
entityEngine = new World(builder);
}
public void render() {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
entityEngine.setDelta(Gdx.graphics.getDeltaTime());
entityEngine.process();
}
public class MapRenderSystem extends BaseSystem {
public MapRenderSystem() {
this.renderer = new OrthogonalTiledMapRenderer(mapSystem.getCurrentMap().getMap());
}
}
public class MapSystem extends BaseSystem {
private IGameMap currentMap;
public MapSystem() {
this(0);
}
public MapSystem(int id) {
changeMap(id);
}
public void changeMap(int id) {
this.currentMap = MapHandler.get(id);
}
protected void processSystem(){}
It´s thrown from mapSystem.getCurrentMap(). mapSystem is null, although it should have been injected by artemis.
2nd)
Let´s say I want when an Character has the ChangeMapComponent to change the Map.
Means I will have to extend form BaseEntitySystem? but what then?
processSystem() is once per tick called. But changing the Map is rarely -> so more an Event. How do I get to know that an Character has that Component and then process the System? Or shall I just make an Method in mapSystem for that purpose which is called by something like MovementSystem?, But wouldn´t it be with that pretty useless to even extend from an System?