private void PlayVoice(string fmodPath, SpeakerContainer currentSpeaker) { if (!string.IsNullOrEmpty(fmodPath.Trim())) { FMODUnity.RuntimeManager.PlayOneShot(fmodPath, currentSpeaker.speakerObject.transform.position); } }
public void AddSpeaker(SpeakerContainer speaker) { if (speakers.ContainsKey(speaker.id)) { Debug.LogError("Trying to add a speaker that already exists"); return; } speaker.SetSpeakerUI(); speakers.Add(speaker.id, speaker); }
void SetDialogueLine(Conversation conversation) { //Display Line Line line = conversation.lines[activeConversations[conversation].activeLineIndex]; SpeakerContainer currentSpeaker = speakers[line.id]; // Hide all speakers from that conversation HideAllSpeakers(conversation); TextMeshProUGUI textMesh = currentSpeaker.speakerUI.conversationText; currentSpeaker.speakerUI.SetActiveAButton(!activeConversations[conversation].isAutoPlaying); PlayVoice(currentSpeaker.npcVoicePath, currentSpeaker); if (activeConversations[conversation].isTyping && activeConversations[conversation].typingCoroutine != null) { StopCoroutine(activeConversations[conversation].typingCoroutine); } activeConversations[conversation].SetTypingCoroutine(StartCoroutine(StartTypeText(conversation, textMesh, line.text))); currentSpeaker.speakerUI.Show(); }