public void BeforeEach() { _database = Substitute.For <IDatabaseInstance>(); #pragma warning disable 618 _ctrl = new DialogueController(_database); #pragma warning restore 618 _playback = Substitute.For <IDialoguePlayback>(); }
protected override void OnPlay(IDialoguePlayback playback) { _emittedChoices = GetValidChoices(playback); if (_emittedChoices.Count > 0) { playback.Events.Choice.Invoke(_actor, _dialogue, _emittedChoices); return; } playback.Events.Speak.Invoke(_actor, _dialogue); }
private List <IChoice> GetValidChoices(IDialoguePlayback playback) { var child = Next(); if (_choices.Count == 0 && child?.HubChoices != null && child.HubChoices.Count > 0) { playback.Events.NodeEnter.Invoke(child); return(child.HubChoices); } return(_choices.Where(c => c.IsValid).ToList()); }
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(); }
protected virtual void OnPlay(IDialoguePlayback playback) { playback.Next(); }
public void Play(IDialoguePlayback playback) { playback.Events.NodeEnter.Invoke(this); OnPlay(playback); }
public void Play(IDialoguePlayback playback) { throw new System.NotImplementedException(); }
protected override void OnPlay(IDialoguePlayback playback) { playback.ParentCtrl.PlayChild(_graph); }
public void BeforeEachMethod() { _parentPlayback = Substitute.For <IDialoguePlayback>(); _ctrl.Play(_parentPlayback); }