DialogActionRunner API
DialogActionRunner is the runtime dispatcher for action nodes and manual action invocation.
Responsibilities
- invoke synchronous UnityEvent bindings by
actionId - run coroutine-based asynchronous handlers through
IActionHandler - support per-conversation action sets keyed by
dialogID - optionally fall back to a global action set
Convenience methods
StartCoroutine(actionRunner.RunActionGlobal(
actionId: "PlaySfx",
payloadJson: "{\"clip\":\"ding\"}",
waitForCompletion: false));
StartCoroutine(actionRunner.RunActionForConversation(
dialogId: "intro_guard",
actionId: "UnlockGate",
payloadJson: "{\"gateId\":\"north\"}",
waitForCompletion: true));
Async handler example
using System.Collections;
using DialogSystem.Runtime.Interfaces;
using UnityEngine;
public class UnlockGateHandler : MonoBehaviour, IActionHandler
{
public bool CanHandle(string actionId) => actionId == "UnlockGate";
public IEnumerator Handle(string actionId, string payloadJson)
{
Debug.Log($"Unlock gate with payload: {payloadJson}");
yield return null;
}
}