I am working on a card game in Unity and want to implement a system where I can create card effects that happen when certain events are triggered.
The events could be anything from when a card is played or destroyed, to more complex events like buying and playing 3 cards in the same turn, for example. Similarly, the effects could be any number of things, from draw a card, to deal damage to all enemy units of a specified type.
The strategy I am currently considering is to have an event queue, and whenever anything happens, push an event object containing data about what just happened to the queue. Then, create a data structure to store a pointer to an Event class, which has a method that looks at the event queue and determines if the event has happened, and a pointer to an Effect class, which invokes a method to make something happen in the game. The cards will monitor the event queue and if it detects that the event was triggered, invoke the effect.
My concern is that this requires a lot of subclasses for each event and effect which will really muddy the codebase. Ideally I would be able to create new effects entirely within the inspector using enums for the event trigger and effect, but don't know how this would be implemented.
If anyone with experience of these kinds of systems has any advice regarding if this is the way to go, or on the implementation it would be greatly appreciated.