예제 #1
0
        private void Update()
        {
            if (Input.GetButtonDown("Pause"))
            {
                TogglePaused();
            }

            if (nextTimeIndex >= SubtitleTimes.Count)
            {
                return;
            }
            if (video.time >= SubtitleTimes[nextTimeIndex])
            {
                Subtitles.Say(SubtitleData[SubtitleTimes[nextTimeIndex]], 10000000);
                nextTimeIndex++;
            }
        }
예제 #2
0
        private void Play(VoiceLine line)
        {
            if (Random.Range(0f, 1f) > line.ChanceOfPlaying)
            {
                return;
            }

            SoundsSource.pitch = 1;
            var clip = line.RandomClips.RandomItem();

            SoundsSource.PlayOneShot(clip.audio, line.VolumeScale);

            if (clip.subtitle.IsNullOrEmpty())
            {
                Debug.LogWarning($"the voice line {line.name} doesn't have a subtitle!");
            }
            else
            {
                Subtitles.Say(clip.subtitle, clip.audio.length);
            }
        }