|
|
|
|
|
|
using UnityEngine; |
|
|
|
|
|
|
|
|
|
|
|
public enum InitialState { Idle = 0, Walk, Talk }; |
|
|
|
public enum TownsfolkState { Idle = 0, Walk, Talk }; |
|
|
|
public InitialState InitialState; //This is checked by conditions in the StateMachine
|
|
|
|
public TownsfolkState townsfolkState; //This is checked by conditions in the StateMachine
|
|
|
|
public GameObject[] talkingTo; |
|
|
|
|
|
|
|
private DialogueDataChannelSO _startDialogueEvent = default; |
|
|
|
private VoidEventChannelSO _endDialogueEvent = default; |
|
|
|
|
|
|
|
private void OnEnable() |
|
|
|
{ |
|
|
|
if (_startDialogueEvent != null) |
|
|
|
_startDialogueEvent.OnEventRaised += StopTalking; |
|
|
|
|
|
|
|
if (_endDialogueEvent != null) |
|
|
|
_endDialogueEvent.OnEventRaised += ResumeTalking; |
|
|
|
} |
|
|
|
|
|
|
|
void Start() |
|
|
|
private void StopTalking(DialogueDataSO dialogue) |
|
|
|
|
|
|
|
} |
|
|
|
for (int i = 0; i < talkingTo.Length; ++i) |
|
|
|
{ |
|
|
|
if (talkingTo[i].GetComponent<StepController>().IsInDialogue) |
|
|
|
{ |
|
|
|
townsfolkState = TownsfolkState.Idle; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
void Update() |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
private void ResumeTalking() |
|
|
|
{ |
|
|
|
for (int i = 0; i < talkingTo.Length; ++i) |
|
|
|
{ |
|
|
|
if (talkingTo[i].GetComponent<StepController>().IsInDialogue) |
|
|
|
return; |
|
|
|
} |
|
|
|
townsfolkState = TownsfolkState.Talk; |
|
|
|
|
|
|
|
} |
|
|
|
} |