Skip to main content

Class ActorSpeedMessageRelay

Listens for ActorSpeedMessage events via the IEventAggregator and relays them through a UnityEvent. This allows connecting to UI components or other systems in the Inspector.

public class ActorSpeedMessageRelay : MessageRelay<ActorSpeedMessage>, IHandle<ActorSpeedMessage>

Inheritance​

Implements​

IHandle<ActorSpeedMessage>

Inherited Members​

Fields​

OnSpeedReceived​

UnityEvent(s) invoked when a ActorSpeedMessage is received.

[SerializeField]
[Tooltip("Invoked when a message is received.")]
protected UnityEvent<float> OnSpeedReceived

Field Value​

UnityEvent<float>

Methods​

Handle(ActorSpeedMessage)​

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

public override void Handle(ActorSpeedMessage message)

Parameters​

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