public void AddOption(string _option, DialogueBase _target)
        {
            DialogueOption option = new DialogueOption(_option, _target);

            option.option = _option;
            m_Options.Add(option);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        protected virtual void Listen(Dialogue dialogue)
        {
            dialogueIsActive = true;
            activeDialogue   = dialogue;

            activeDialogueBase = activeDialogue.GetInitial();
            activeDialogueBase.Initiate(this);
            //OnStart();
        }
Пример #5
0
        protected void Iterate(int index)
        {
            activeDialogueBase = activeDialogue.GetNext(activeDialogueBase, index);
            activeDialogueBase.Initiate(this);

            if (activeDialogueBase.name == "End")
            {
                GameObject.FindObjectOfType <DialogueSystem>().CallEnd();
            }
        }