|
|
|
|
|
|
using System.Collections; |
|
|
|
using System.Collections.Generic; |
|
|
|
using UnityEngine; |
|
|
|
using UnityEngine.Events; |
|
|
|
//this script needs to be put on the actor, and takes care of the current step to accomplish.
|
|
|
|
//the step contains a dialogue and maybe an event.
|
|
|
|
|
|
|
|
|
|
|
[SerializeField] private VoidEventChannelSO _loseDialogueEvent = default; |
|
|
|
|
|
|
|
[Header("Broadcasting on channels")] |
|
|
|
[SerializeField] private DialogueDataChannelSO _startDialogueEvent = default; |
|
|
|
//[SerializeField]
|
|
|
|
public DialogueDataChannelSO _startDialogueEvent = default; |
|
|
|
[SerializeField] private VoidEventChannelSO _endDialogueEvent = default; |
|
|
|
//[SerializeField]
|
|
|
|
public VoidEventChannelSO _endDialogueEvent = default; |
|
|
|
private DialogueDataSO _currentDialogue; |
|
|
|
|
|
|
|
public bool isInDialogue; //Consumed by the state machine
|
|
|
|
private DialogueDataSO _currentDialogue; |
|
|
|
public bool IsInDialogue = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void PlayDefaultDialogue() |
|
|
|
|
|
|
|
|
|
|
void StartDialogue() |
|
|
|
{ |
|
|
|
|
|
|
|
IsInDialogue = true; |
|
|
|
|
|
|
|
|
|
|
|
StopTalkingToCurrentActor(); |
|
|
|
isInDialogue = true; |
|
|
|
IsInDialogue = false; |
|
|
|
|
|
|
|
ResumeTalkingToCurrentActor(); |
|
|
|
isInDialogue = false; |
|
|
|
} |
|
|
|
|
|
|
|
void PlayLoseDialogue() |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PlayWinDialogue() |
|
|
|
{ |
|
|
|
if (_questData != null) |
|
|
|
|
|
|
_currentDialogue = displayDialogue; |
|
|
|
StartDialogue(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
private void StopTalkingToCurrentActor() |
|
|
|
{ |
|
|
|
GameObject[] talkingTo = gameObject.GetComponent<Townsfolk>().talkingTo; |
|
|
|
for (int i = 0; i < talkingTo.Length; ++i) |
|
|
|
{ |
|
|
|
talkingTo[i].GetComponent<Townsfolk>().townsfolkState = TownsfolkState.Idle; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void ResumeTalkingToCurrentActor() |
|
|
|
{ |
|
|
|
GameObject[] talkingTo = GetComponent<Townsfolk>().talkingTo; |
|
|
|
for (int i = 0; i < talkingTo.Length; ++i) |
|
|
|
{ |
|
|
|
talkingTo[i].GetComponent<Townsfolk>().townsfolkState = TownsfolkState.Talk; |
|
|
|
} |
|
|
|
} |
|
|
|
|