Exemple #1
0
        private void ProcessDialogNode(int dialogIndex)
        {
            //Debug.Log("CharacterAbilitymanager.ProcessDialogNode()");
            DialogNode currentDialogNode = currentDialog.MyDialogNodes[dialogIndex];

            captionText.text  = currentDialogNode.MyDescription;
            captionText.color = new Color32(255, 255, 255, 0);
            dialogCoroutine   = StartCoroutine(FadeInText());

            if (AudioManager.MyInstance != null && currentDialog.MyAudioProfile != null && currentDialog.MyAudioProfile.MyAudioClips != null && currentDialog.MyAudioProfile.MyAudioClips.Count > dialogIndex)
            {
                AudioManager.MyInstance.PlayEffect(currentDialog.MyAudioProfile.MyAudioClips[dialogIndex]);
            }


            currentDialogNode.MyShown = true;
        }
Exemple #2
0
        public IEnumerator playDialog()
        {
            //Debug.Log("CharacterAbilitymanager.playDialog()");
            float      elapsedTime       = 0f;
            DialogNode currentdialogNode = null;

            while (currentDialog.TurnedIn == false)
            {
                foreach (DialogNode dialogNode in currentDialog.MyDialogNodes)
                {
                    if (dialogNode.MyStartTime <= elapsedTime && dialogNode.MyShown == false)
                    {
                        currentdialogNode = dialogNode;

                        ProcessDialogNode(dialogIndex);
                        dialogIndex++;
                    }
                }

                /*
                 * if (dialogIndex >= currentDialog.MyDialogNodes.Count) {
                 *  currentDialog.TurnedIn = true;
                 * }
                 */
                elapsedTime += Time.deltaTime;

                // circuit breaker
                if (elapsedTime >= maxDialogTime)
                {
                    break;
                }
                yield return(null);

                dialogCoroutine = null;
            }

            //yield return new WaitForSeconds(currentdialogNode.MyShowTime);
        }