Ejemplo n.º 1
0
        public virtual IEnumerator SayInternal(string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, bool stopVoiceover, AudioClip voiceOverClip, Action onComplete)
        {
            Writer writer = GetWriter();

            if (writer.isWriting || writer.isWaitingForInput)
            {
                writer.Stop();
                while (writer.isWriting || writer.isWaitingForInput)
                {
                    yield return(null);
                }
            }

            gameObject.SetActive(true);

            this.fadeWhenDone = fadeWhenDone;

            // Voice over clip takes precedence over a character sound effect if provided

            AudioClip soundEffectClip = null;

            if (voiceOverClip != null)
            {
                WriterAudio writerAudio = GetWriterAudio();
                writerAudio.PlayVoiceover(voiceOverClip);
            }
            else if (speakingCharacter != null)
            {
                soundEffectClip = speakingCharacter.soundEffect;
            }

            yield return(StartCoroutine(writer.Write(text, clearPrevious, waitForInput, stopVoiceover, soundEffectClip, onComplete)));
        }
Ejemplo n.º 2
0
        protected virtual IEnumerator SayInternal(string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, AudioClip voiceOverClip, Action onComplete)
        {
            Writer writer = GetWriter();

            // Stop any existing Say Command and write this one instead
            // This will probably take a frame or two to complete
            while (writer.isWriting || writer.isWaitingForInput)
            {
                writer.Stop();
                yield return(null);
            }

            this.fadeWhenDone = fadeWhenDone;

            // Voice over clip takes precedence over a character sound effect if provided

            AudioClip soundEffectClip = null;

            if (voiceOverClip != null)
            {
                WriterAudio writerAudio = GetWriterAudio();
                writerAudio.PlayVoiceover(voiceOverClip);
            }
            else if (speakingCharacter != null)
            {
                soundEffectClip = speakingCharacter.soundEffect;
            }
            writer.Write(text, clearPrevious, waitForInput, soundEffectClip, onComplete);
        }