Exemplo n.º 1
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);
        }
Exemplo n.º 2
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)));
        }
Exemplo n.º 3
0
        protected virtual IEnumerator SayInternal(string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, AudioClip audioClip, 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;

            // Look for a character sound effect if no voice over clip is specified
            AudioClip clip = audioClip;

            if (speakingCharacter != null &&
                clip == null)
            {
                clip = speakingCharacter.soundEffect;
            }

            writer.Write(text, clearPrevious, waitForInput, clip, onComplete);
        }