Class BatteryMessageRelay
Listens for BatteryMessage events via the IEventAggregator and relays the data through UnityEvent. This allows connecting to UI components or other systems in the Inspector.
public class BatteryMessageRelay : MessageRelay<BatteryMessage>, IHandle<BatteryMessage>
Inheritance
Implements
Inherited Members
- MessageRelay<BatteryMessage>.m_ChannelKey
- MessageRelay<BatteryMessage>.OnEnable()
- MessageRelay<BatteryMessage>.OnDisable()
- MessageRelay<BatteryMessage>.Handle(BatteryMessage)
Methods
Handle(BatteryMessage)
Receives the BatteryMessage from the aggregator and converts it into the appropriate UnityEvent invocation.
public override void Handle(BatteryMessage message)
Parameters
| Name | Type | Description |
|---|---|---|
message | BatteryMessage | The message payload delivered by the aggregator. |
Remarks
Subclasses extract the relevant fields from message and pass them to
their declared UnityEvent. For example, a battery relay would call
OnBatteryLevelChanged?.Invoke(msg.level).