처음부분 추가
This commit is contained in:
@@ -82,7 +82,7 @@ public async Awaitable Play()
|
||||
|
||||
// 이벤트존 타임라인(컷씬) 재생 중에도 무시 — 컷씬이 NPC 루트를 직접 움직이는 동안
|
||||
// 대화를 시작하면 회전 캡처/복원이 타임라인과 충돌해서 방향이 꼬인다
|
||||
if (EventZone.IsAnyPlaying) return;
|
||||
if (EventZoneTimeline.IsAnyPlaying) return;
|
||||
|
||||
// 다른 NPC의 선택 메뉴가 떠 있으면 먼저 취소한다.
|
||||
// (취소된 쪽의 Play가 이 자리에서 HUD 숨김 등 정리를 마친 뒤에 이쪽이 시작된다)
|
||||
@@ -131,6 +131,56 @@ public async Awaitable Play()
|
||||
}
|
||||
}
|
||||
|
||||
// 조건/선택 메뉴를 건너뛰고 특정 대화 그룹을 강제로 시작한다 (EventZoneTrigger 등 UnityEvent 연결용).
|
||||
// _dialogs에 등록된 그룹이면 그 항목의 설정(진행도 보상 등)을 그대로 쓰고, 없으면 임시 항목으로 재생한다.
|
||||
// 완료 여부는 검사하지 않으므로(강제) 1회성이 필요하면 호출하는 쪽(존의 Trigger Once)에서 보장할 것.
|
||||
public void PlayGroup(DialogGroup group)
|
||||
{
|
||||
_ = PlayGroupForced(group);
|
||||
}
|
||||
|
||||
private async Awaitable PlayGroupForced(DialogGroup group)
|
||||
{
|
||||
if (group == null || IsPlaying) return;
|
||||
if (_entryInProgress != null) return; // 다른 NPC가 대사 재생 중
|
||||
if (EventZoneTimeline.IsAnyPlaying) return; // 컷씬 중엔 시작하지 않음 (Play()와 동일한 이유)
|
||||
|
||||
// 다른 NPC의 선택 메뉴가 떠 있으면 먼저 취소
|
||||
if (ChoiceHud.Instance != null)
|
||||
ChoiceHud.Instance.CancelPending();
|
||||
|
||||
IsPlaying = true;
|
||||
try
|
||||
{
|
||||
// 등록된 항목이 있으면 Repeatable/ProgressOnComplete 설정을 그대로 사용
|
||||
DialogEntry entry = _dialogs.Find(e => e.Group == group);
|
||||
if (entry.Group == null)
|
||||
entry = new DialogEntry { Group = group };
|
||||
|
||||
_originalRotations.TryAdd(transform, GetOriginalRotation(transform));
|
||||
RotateTowardPlayer(transform);
|
||||
|
||||
if (_dialogStartDelay > 0f)
|
||||
{
|
||||
await Awaitable.WaitForSecondsAsync(_dialogStartDelay, destroyCancellationToken);
|
||||
if (_entryInProgress != null) return; // 기다리는 사이 다른 NPC의 대화가 시작됨
|
||||
}
|
||||
|
||||
_entryInProgress = this;
|
||||
await PlayEntry(entry);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// 씬 전환 등으로 취소됨 — PlayEntry의 finally에서 정리됨
|
||||
}
|
||||
finally
|
||||
{
|
||||
RestoreRotations();
|
||||
if (_entryInProgress == this) _entryInProgress = null;
|
||||
IsPlaying = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 조건을 만족하고 (반복 가능하거나 아직 안 한) 대화들의 인덱스. 리스트 순서 유지.
|
||||
private List<int> FindPlayableIndices()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user