Signal_TEvent_.md
July 25, 2024 ยท View on GitHub
Friflo.Engine.ECS
Friflo.Engine.ECS
Signal Struct
Signal<TEvent>'s are used to emit custom events from an entity to custom Signal<TEvent> handlers.
See Example.
public readonly struct Signal<TEvent>
where TEvent : struct, System.ValueType, System.ValueType
Type parameters
TEvent
The event type containing the fields of a custom event.
Remarks
Signal<TEvent> handlers are added with AddSignalHandler<TEvent>(Action<Signal<TEvent>>).
They are used to implement the Observer pattern
on entity level in the engine.
It enables decoupling the code used for emitting events from a specific entity (aka subject / publisher)
to multiple subscribers (aka observers) consuming the event by their Signal<TEvent> handlers.
| Fields | |
|---|---|
| EntityId | The id of the Entity that emitted the Event with EmitSignal<TEvent>(TEvent). |
| Event | The Event containing event specific data passed to EmitSignal<TEvent>(TEvent). |
| Store | The EntityStore containing the Entity that emitted the Event. |
| Properties | |
|---|---|
| Entity | The Entity that emitted the Event with EmitSignal<TEvent>(TEvent) - aka the publisher. |
| Methods | |
|---|---|
| ToString() |