The CommandSystem provides a generic, domain-routed command infrastructure that allows systems to request actions from one another in a decoupled, type-safe manner. It replaces feature-specific command classes with a single unified Command envelope carrying a verb and typed parameters.
CommandSystem is the imperative side of SaffronLibrary's messaging stack. It sends one-way messages to a target system identified by Domain, with the system's flow controller receiving and routing each command to the appropriate handler. Use it whenever you need to tell another system to do something: opening a UI panel, playing audio, starting an animation, or triggering any other action.
Key responsibilities:
- Define a generic
Commandclass that routes byDomainand identifies the requested action via verb. - Provide the
ICommandinterface contract that all commands implement, exposing the targetDomain, verb, and typed parameter bag. - Connect to the
CommandBusfor routing and toFlowControllerfor receiving and dispatching commands within each domain.
Who should use it:
- Any system that needs to tell another domain to do something (e.g., UI playing audio, gameplay triggering VFX).
- Flow controllers that own a domain and receive commands sent to it.
- Builders and factories that construct commands on behalf of their caller.