Skip to main content

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​

IHandle<BatteryMessage>

Inherited Members​

Methods​

Handle(BatteryMessage)​

Receives the BatteryMessage from the aggregator and converts it into the appropriate UnityEvent invocation.

public override void Handle(BatteryMessage message)

Parameters​

NameTypeDescription
messageBatteryMessageThe 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).