namespace OECS; /// /// A command that resolves a pending interrupt of type . /// /// The default implementation looks up the pending /// interrupt, calls to let the handler inspect it, and /// resolves the interrupt if the handler returns true. /// /// The interrupt type this handler resolves. public interface IInterruptHandlerCommand : ICommand where TInterrupt : struct, IInterrupt { void ICommand.Execute(World world) { if (world.TryGetPendingInterrupt(out var interrupt)) { if (TryResolve(interrupt)) { world.ResolveInterrupt(); } } } /// /// Called by the default with the pending interrupt. /// Return true to resolve and remove the interrupt; false to leave it /// pending for another handler. /// bool TryResolve(TInterrupt interrupt); }