Interaction - WEKIT-ECS/MIRAGE-XR GitHub Wiki
[!WARNING]
This implementation is currently not used, but building up for the refactoring of the improved interaction of content types.
An EventManager for Content Interactions
The ContentInteractionEventManager.cs
allows subscribing to interaction events of the content augmentations. This is how it is used in:
ContentInteractionEventManager.StartListening("onPickPlaceCorrect", OnTrigger);
The callback OnTrigger
in the same class then looks like this:
public async void OnTrigger(Dictionary<string, object> message)
{
await SomeCallOrAnother();
}
Likely, this event should be deregistered in an onDestroy
routine or similar:
public void OnDestroy()
{
if (!String.IsNullOrEmpty(_outEvent)) ContentInteractionEventManager.StopListening(_outEvent, OnTrigger);
}
Triggers
The triggers are set up in ActivityManager.cs
by calling Trigger.SetupTriggers(step);
where relevant (e.g. in ActivateAction()
). The setup routine in the Trigger
class then adds an EventTrigger behaviour to the triggers holder GameObject var eventBehaviour = eventTriggerObj.AddComponent<EventTrigger>();
.
This class EventTrigger.cs
has the editor view routines for updating the data model following changes in an edit panel. It also has the player view routines to initialize the trigger and register the callback.