浏览代码

edited townsfolk script to move methods to step controller

/main
Amel Negra 3 年前
当前提交
e446a5a7
共有 1 个文件被更改,包括 1 次插入38 次删除
  1. 39
      UOP1_Project/Assets/Scripts/Characters/Townsfolk.cs

39
UOP1_Project/Assets/Scripts/Characters/Townsfolk.cs


using System.Collections.Generic;
using UnityEngine;
private DialogueDataChannelSO _startDialogueEvent = default;
private VoidEventChannelSO _endDialogueEvent = default;
private void OnEnable()
{
if (_startDialogueEvent != null)
_startDialogueEvent.OnEventRaised += StopTalking;
if (_endDialogueEvent != null)
_endDialogueEvent.OnEventRaised += ResumeTalking;
}
}
private void StopTalking(DialogueDataSO dialogue)
{
for (int i = 0; i < talkingTo.Length; ++i)
{
if (talkingTo[i].GetComponent<StepController>().IsInDialogue)
{
townsfolkState = TownsfolkState.Idle;
return;
}
}
}
private void ResumeTalking()
{
for (int i = 0; i < talkingTo.Length; ++i)
{
if (talkingTo[i].GetComponent<StepController>().IsInDialogue)
return;
}
townsfolkState = TownsfolkState.Talk;
}
}
正在加载...
取消
保存