Skip to content

Reactor

Hosts targets that observe sources (values, events, signals, cycles) and dispatch reactions.

Namespace: Jungle.Data Inherits: ControllableComponentMonoBehaviour

Overview

Reactor is the host component for the reactive system. It owns a list of IReactorTarget items; each target watches one source — a typed observable value, an event, a signal received via Receive, or a frame cycle — and runs its own list of (trigger, body) reactions when the source's triggers fire.

The Reactor itself is the lifecycle host: targets begin and end with the component. You can put many targets on one Reactor or split them across components — both work.

When something pushes a signal in via Receive(SignalType), the Reactor fans it out to every ISignalReceivingTarget in its target list.

Properties

Property Type Description
targets List<IReactorTarget> Targets watched by this reactor. Each holds one source plus a list of (trigger, body) reactions.

Methods

Method Description
Receive(SignalType) Pushes a signal into every signal-receiving target on this reactor.
Receive(SignalType, Object caller) Same as above but records the caller for debug visualisation.
static TryGet(GameObject, out Reactor, bool searchParents, bool searchChildren, bool includeInactiveChildren) Locates a Reactor on the GameObject, optionally checking parents/children.

See Also