/// <summary> /// Play the voice when the dialogue actually changes /// </summary> /// <param name="dialogueChangedEventData"></param> private void OnDialogueChanged(DialogueChangedEventData dialogueChangedEventData) { if (willSaySomething) { audioSource.Play(); } willSaySomething = false; }
private void OnDialogueChanged(DialogueChangedEventData dialogueChangedEventData) { var logEntry = Instantiate(LogEntryPrefab); var logEntryController = logEntry.GetComponent <LogEntryController>(); // TODO unassigned action to log entry buttons logEntryController.Init( dialogueChangedEventData.text, () => { }, () => { }, () => { } ); logEntries.Add(logEntry); logEntry.transform.SetParent(logContent.transform); }
/// <summary> /// The content of the dialogue box needs to be changed /// </summary> /// <param name="text"></param> private void OnDialogueChange(DialogueChangedEventData dialogueData) { var text = dialogueData.text; Debug.Log(string.Format("<color=green><b>{0}</b></color>", text)); // Parse dialogue text var m = Regex.Match(text, namePattern); var dialogueStartIndex = 0; if (m.Success) { currentName = m.Groups[nameGroup].Value; dialogueStartIndex = m.Length; } else { // no name is found currentName = ""; } currentDialogue = text.Substring(dialogueStartIndex).Trim(); // change display nameTextArea.text = currentName; if (!needAniamtion) { dialogueTextArea.text = currentDialogue; return; } // need animantion if (isAnimating) { StopCharacterAnimation(); } StartCharacterAnimation(); }