public void AddOption(string _option, DialogueBase _target) { DialogueOption option = new DialogueOption(_option, _target); option.option = _option; m_Options.Add(option); }
public DialogueBase GetNext(DialogueBase current, int index) { DialogueBase _base = current.Iterate(index); if (_base == null) { Debug.LogError("Cannot iterate to invalid dialogue"); return(null); } foreach (DialogueSpeech speech in speechEntries) { if (_base.name == speech.name) { return(speech); } } foreach (DialogueOptions option in optionsEntries) { if (_base.name == option.name) { return(option); } } if (_base.name == "End") { return(end); } Debug.LogError("Found No Object"); return(null); }
public DialogueBase GetInitial() { DialogueBase _base = start.target; if (_base == null) { Debug.LogError("Cannot iterate to invalid dialogue"); return(null); } foreach (DialogueSpeech speech in speechEntries) { if (_base.name == speech.name) { return(speech); } } foreach (DialogueOptions option in optionsEntries) { if (_base.name == option.name) { return(option); } } if (_base.name == "End") { return(end); } Debug.LogError("Found No Object"); return(null); }
protected virtual void Listen(Dialogue dialogue) { dialogueIsActive = true; activeDialogue = dialogue; activeDialogueBase = activeDialogue.GetInitial(); activeDialogueBase.Initiate(this); //OnStart(); }
protected void Iterate(int index) { activeDialogueBase = activeDialogue.GetNext(activeDialogueBase, index); activeDialogueBase.Initiate(this); if (activeDialogueBase.name == "End") { GameObject.FindObjectOfType <DialogueSystem>().CallEnd(); } }