Does anyone know what Nystrom meant in this excerpt from http://gameprogrammingpatterns.com/observer.html?
I created an example implementation of the observer pattern in c++ from my medal system.
I am wanting to pass my
KillType enum to
onNotify without muddling up the base Observer/Subject classes with that level of specifics.
Medals class needs to know specifics about what type of kill it was so it can award the appropriate medal (ex. Headshot).
Does anyone know of a way to use templates to do this? Or what is a good way to get that level of detail from PlayerState to Medals?
The first thing I thought of was to use polymorphism and an Event class with a bunch of subclasses for each type. But that seems really class heavy to me to just pass some variables around.