public void Play(IDialoguePlayback playback, IGameObjectOverride[] gameObjectOverrides = null) { SetupDatabases(gameObjectOverrides); Stop(); playback.Events.Speak.AddListener(TriggerSpeak); playback.Events.Choice.AddListener(TriggerChoice); playback.Events.NodeEnter.AddListener(TriggerEnterNode); playback.Events.Begin.AddListener(TriggerBegin); playback.Events.End.AddListener(TriggerEnd); _activeDialogue.Push(playback); playback.Play(); }
public void PlayChild(IDialoguePlayback playback) { if (ActiveDialogue == null) { throw new InvalidOperationException("Cannot trigger child dialogue, nothing is playing"); } var parentDialogue = ActiveDialogue; playback.Events.End.AddListener(() => { _activeDialogue.Pop(); parentDialogue.Next(); }); playback.Events.Speak.AddListener(TriggerSpeak); playback.Events.Choice.AddListener(TriggerChoice); playback.Events.NodeEnter.AddListener(TriggerEnterNode); _activeDialogue.Push(playback); playback.Play(); }