using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// Takes care of all things dialogue, whether they are coming from within a Timeline or just from the interaction with a character, or by any other mean. /// Keeps track of choices in the dialogue (if any) and then gives back control to gameplay when appropriate. /// public class DialogueManager : MonoBehaviour { [SerializeField] private InputReader _inputReader = default; [SerializeField] DialogueLineChannelSO dialogueLineEvent; /// /// Called to begin a dialogue, i.e. a sequence of lines that require the player's input to move forward. /// /// public void BeginDialogue(DialogueLineSO firstLine) { _inputReader.EnableDialogueInput(); DisplayDialogueLine(firstLine); } /// /// Displays a line of dialogue in the UI, by requesting it to the DialogueManager. /// This function is also called by DialogueBehaviour from clips on Timeline during cutscenes. /// /// public void DisplayDialogueLine(DialogueLineSO dialogueLine) { //TODO: Interface with a UIManager to allow displayal of the line of dialogue in the UI //Debug.Log("A line of dialogue has been spoken: \"" + dialogueLine.Sentence + "\" by " + dialogueLine.Actor.ActorName); if (dialogueLineEvent != null) dialogueLineEvent.OnEventRaised(dialogueLine); } }