private void SetEvents(DialogueRunner dialogue) { RemoveEvents(dialogue); if (dialogue.IsNull()) { return; } if (dialogue.onNodeStart.IsNull()) { dialogue.onNodeStart = new DialogueRunner.StringUnityEvent(); } if (dialogue.onNodeComplete.IsNull()) { dialogue.onNodeComplete = new DialogueRunner.StringUnityEvent(); } if (dialogue.onDialogueComplete.IsNull()) { dialogue.onDialogueComplete = new UnityEngine.Events.UnityEvent(); } dialogue.onNodeStart.AddListener(OnNodeStart); dialogue.onNodeComplete.AddListener(OnNodeComplete); dialogue.onDialogueComplete.AddListener(OnDialogComplete); }
private void RemoveEvents(DialogueRunner dialogue) { if (dialogue.IsNull()) { return; } dialogue.onNodeStart?.RemoveListener(OnNodeStart); dialogue.onNodeComplete?.RemoveListener(OnNodeComplete); dialogue.onDialogueComplete?.RemoveListener(OnDialogComplete); }