Class EventBus
- Namespace
- MoonBark.GridPlacement.Core.Events
- Assembly
- MoonBark.GridPlacement.Core.dll
Base class for domain event buses providing common publish functionality. Engine-agnostic implementation with no Godot or Unity dependencies.
Purpose: Reduces boilerplate by providing a common Publish method pattern that invokes event handlers if they are subscribed.
Architecture Boundary: Core ECS systems → EventBus implementations → Engine adapter bridges
public abstract class EventBus
- Inheritance
-
EventBus
- Derived
- Inherited Members
Remarks
Each derived EventBus should:
- Define public event fields:
public event Action<TEvent>? OnX; - Call
Publish(event)in each Publish method to trigger subscribers
Methods
Publish<TEvent>(Action<TEvent>?, TEvent)
Publishes an event by invoking its handler if subscribed.
protected static void Publish<TEvent>(Action<TEvent>? handler, TEvent @event)
Parameters
handlerAction<TEvent>The event handler delegate
eventTEventThe event instance to pass to handlers
Type Parameters
TEventThe event type to publish