您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
36 行
1.5 KiB
36 行
1.5 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
public class DialogueManager : MonoBehaviour
|
|
{
|
|
[SerializeField] private InputReader _inputReader = default;
|
|
[SerializeField] DialogueLineChannelSO dialogueLineEvent;
|
|
/// <summary>
|
|
/// Called to begin a dialogue, i.e. a sequence of lines that require the player's input to move forward.
|
|
/// </summary>
|
|
/// <param name="firstLine"></param>
|
|
public void BeginDialogue(DialogueLineSO firstLine)
|
|
{
|
|
_inputReader.EnableDialogueInput();
|
|
DisplayDialogueLine(firstLine);
|
|
}
|
|
|
|
/// <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>
|
|
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);
|
|
|
|
}
|
|
}
|