Example #1
0
 private void PlayVoice(string fmodPath, SpeakerContainer currentSpeaker)
 {
     if (!string.IsNullOrEmpty(fmodPath.Trim()))
     {
         FMODUnity.RuntimeManager.PlayOneShot(fmodPath, currentSpeaker.speakerObject.transform.position);
     }
 }
Example #2
0
 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);
 }
Example #3
0
    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();
    }