コード例 #1
0
        /// <summary>
        /// USED FROM A DIALOG ANSWER HANDLER
        /// Display the selected Dialog Line and procede to the next dialog set
        /// </summary>
        /// <param name="_line">The line to display</param>
        public IEnumerator DisplayDialogueLine(DialogueLine _line)
        {
            // Call the event
            OnDialogLineRead?.Invoke(_line.Key);
            // Change the color of the font if needed
            if (!DialoguesSettingsManager.DialogsSettings.OverrideCharacterColor)
            {
                if (DialoguesSettingsManager.DialogsSettings.CharactersColor.Any(c => c.CharacterIdentifier == _line.CharacterIdentifier))
                {
                    m_textDisplayer.color = DialoguesSettingsManager.DialogsSettings.CharactersColor.Where(c => c.CharacterIdentifier == _line.CharacterIdentifier).Select(c => c.CharacterColor).FirstOrDefault();
                }
                else
                {
                    m_textDisplayer.color = m_fontColor;
                }
            }
            else
            {
                m_textDisplayer.color = m_fontColor;
            }
            // Change the text of the text displayer
            m_textDisplayer.text = GetDialogueLineContent(_line.Key, DialoguesSettingsManager.DialogsSettings.CurrentLocalisationKey);
            // If there is an audiosource and the AudioClip Exists in the DialogsAssetsManager, play the audioclip in OneShot
            if (m_audioSource != null && DialogueAssetsManager.DialogLinesAudioClips.ContainsKey(_line.Key + "_" + DialoguesSettingsManager.DialogsSettings.CurrentAudioLocalisationKey))
            {
                m_audioSource.PlayOneShot(DialogueAssetsManager.DialogLinesAudioClips[_line.Key + "_" + DialoguesSettingsManager.DialogsSettings.CurrentAudioLocalisationKey]);
            }
            yield return(new WaitForSeconds(_line.InitialWaitingTime));

            // Go to the next set
            DialogueSet _nextSet = m_dialog.GetNextSet(_line.LinkedToken);

            DisplayDialogueSet(_nextSet);
        }