Closed bitbrain closed 6 years ago
Instead of defining indivual listeners per game component, have a so called EventManager:
EventManager eventManager = context.getEventManager();
It is the possible to implement custom events:
class MyTestEvent implements GameEvent { }
In order to produce:
eventManager.publish(new MyTestEvent());
In order to consume:
eventManager.register(new GameEventListener<MyTestEvent>() { @Override public void onEvent(MyTestEvent event) { // do something with the event } });
Instead of defining indivual listeners per game component, have a so called EventManager:
It is the possible to implement custom events:
In order to produce:
In order to consume: