I'm trying to get my head around how to create a debug console and have a hard problem to figure out how it access different objects in my game.
Say for example I want the console to be able to:
- Add new enemies on current map -> This requires access to the current map or some entity service
- Add a new component to a current entity -> This requires access to some current entity list.
- Change settings -> This require access to some settings service/manager
- Change map -> This requires access to some map service/manager
- Start a new game event -> This requires access to maybe some maps event handle.
It seems like this list may just grow and grow with new commands with new dependencies and I wonder how you structre this? How does for example the Half-life console work?
It feels a bit rough to just have something like this:
var console = new DebugConsole() console.AddCommand(new AddEntityCommand(entityService)) console.AddCommand(new SettingsCommand(settingsService)) etc
But maybe that's the way to do it?