//End dialogue void EndDialogue(IDialogueLine dialogue, CharacterSO actorSo) { // depending on the dialogue that ended, do something. The dialogue type can be different from the current dialogue type switch (dialogue.DialogueType) { case DialogueType.StartDialogue: // Check the validity of the step CheckTaskValidity(); break; case DialogueType.WinDialogue: // After playing the win dialogue close Dialogue and end step break; case DialogueType.LoseDialogue: // closeDialogue // replay start Dialogue if the lose Dialogue ended if (_currentTask.StoryBeforeTask != null) { _currentStory = _currentTask.StoryBeforeTask; } break; case DialogueType.DefaultDialogue: // close Dialogue // nothing happens if it's the default dialogue break; } }
void EndDialogue(IDialogueLine dialogue, CharacterSO actorSo) { // depending on the dialogue that ended, do something switch (dialogue.DialogueType) { case DialogueType.WinDialogue: EndTask(); break; } }
// start a dialogue when interaction // some Tasks need to be instantaneous. And do not need the interact button. // when interaction again, restart same dialogue. void InteractWithCharacter(CharacterSO actorToInteractWith) { if (actorToInteractWith == character) { if (_hasActiveStory) { PlayStoryDialogue(); } else if (_hasActiveTask) { PlayTaskDialogue(); } else { PlayDefaultDialogue(); } } }
/// <summary> /// Displays a line of dialogue in the UI, by requesting it to the <c>DialogueManager</c>. /// This function is also called by <c>DialogueBehaviour</c> from clips on Timeline during cutscenes. /// </summary> /// <param name="dialogueLine"></param> /// <param name="character"></param> public void DisplayDialogueLine(IDialogueLine dialogueLine, CharacterSO character) { Debug.Log(dialogueLine); Debug.Log(character); if (openUIDialogueEvent != null) { // send event out before the dialogue starts // InitEvents(); // CallEvents(true); openUIDialogueEvent.RaiseEvent(dialogueLine, character); } ToggleContinueBtn(false); // Call event when the dialogue begins if (dialogueEvent != null && dialogueLine.DialogueEvent.EventName != String.Empty) { dialogueEvent.RaiseEvent(dialogueLine.DialogueEvent.EventName, dialogueLine.DialogueEvent.Value); } m_CurrentActor = character; SetActiveDialogue(dialogueLine); }