public void DisplayMessage(string source, string body, VoiceSample voice = null) { DisplayMessage(body, voice); if (source.Length > 0) { nameBoxFrame.SetActive(true); nameBox.text = source; } }
public void DisplayMessage(string body, VoiceSample voice = null) { if (textWriter) { textWriter.WriteText(body, voice); } else { textBox.text = body; } nameBoxFrame.SetActive(false); }
private void ConfigureChatEntry(DateTime timeStamp, string sourceName, Sprite sourceAvatar, string text, VoiceSample voice = null) { this.timeStamp = timeStamp; this.sourceName = sourceName ?? throw new ArgumentNullException(nameof(sourceName)); this.sourceAvatar = sourceAvatar; this.text = text ?? throw new ArgumentNullException(nameof(text)); this.voice = voice; }
/// <summary> /// Adds the specified text to the buffer and replaces the current 'voice' with a new one. /// </summary> /// <param name="text">The new text to write. Will replace the old one.</param> /// <param name="voice">The sound to play after every written character. Can be null.</param> public void WriteText(string text, VoiceSample voice = null) { textComponent.text = ""; textToWrite = text; this.voice = voice; internalTimer = 0f; skippedSounds = 0; if (voice != null) { timeBetweenEachCharacter = voice.pace; soundsToSkip = voice.soundlessChars; skippedSounds = voice.soundlessChars; sfxSource.clip = voice.baseSFX; sfxSource.outputAudioMixerGroup.audioMixer.SetFloat("Pitch", voice.pitch); sfxSource.outputAudioMixerGroup.audioMixer.SetFloat("Distortion", voice.distortion); } else { soundsToSkip = 0; timeBetweenEachCharacter = 0.05f; } }