コード例 #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);
        }
コード例 #2
0
        protected WriterAudio GetWriterAudio()
        {
            if (writerAudio != null)
            {
                return(writerAudio);
            }

            writerAudio = GetComponent <WriterAudio>();
            if (writerAudio == null)
            {
                writerAudio = gameObject.AddComponent <WriterAudio>();
            }

            return(writerAudio);
        }