대화중에 아웃라인 안뜨게

This commit is contained in:
2026-07-17 11:57:19 +09:00
parent ecfd2d7f47
commit ad6ccadc8e
4 changed files with 91 additions and 2 deletions

View File

@@ -61,6 +61,33 @@ public struct NodeEvent
// 선택 메뉴만 떠 있는 단계는 여기 안 잡힌다 (그 경우는 새 NPC가 메뉴를 취소하고 시작).
private static DialogPlayer _entryInProgress;
// ── 전역 대화 진행 신호 (대화 중 월드 상호작용 차단용) ────────
// 선택 메뉴 단계부터 대사 종료까지, 어느 NPC든 대화가 진행 중이면 true.
// DialogInteractionBlocker가 구독해서 인터랙터를 잠근다.
public static bool IsAnyActive => _activeCount > 0;
public static event Action<bool> AnyActiveChanged;
private static int _activeCount;
private static void PushActive()
{
if (++_activeCount == 1) AnyActiveChanged?.Invoke(true);
}
private static void PopActive()
{
if (_activeCount <= 0) return;
if (--_activeCount == 0) AnyActiveChanged?.Invoke(false);
}
// Enter Play Mode에서 도메인 리로드를 꺼도 이전 상태가 안 남게
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void ResetStatics()
{
_entryInProgress = null;
_activeCount = 0;
AnyActiveChanged = null;
}
private void Awake()
{
_voice = GetComponent<CharacterVoiceObject>();
@@ -91,6 +118,7 @@ public async Awaitable Play()
// 선택 메뉴가 떠 있는 동안에도 재진입을 막아야 하므로 여기서 잠근다.
IsPlaying = true;
PushActive();
try
{
var playable = FindPlayableIndices();
@@ -128,6 +156,7 @@ public async Awaitable Play()
RestoreRotations();
if (_entryInProgress == this) _entryInProgress = null;
IsPlaying = false;
PopActive();
}
}
@@ -150,6 +179,7 @@ private async Awaitable PlayGroupForced(DialogGroup group)
ChoiceHud.Instance.CancelPending();
IsPlaying = true;
PushActive();
try
{
// 등록된 항목이 있으면 Repeatable/ProgressOnComplete 설정을 그대로 사용
@@ -178,6 +208,7 @@ private async Awaitable PlayGroupForced(DialogGroup group)
RestoreRotations();
if (_entryInProgress == this) _entryInProgress = null;
IsPlaying = false;
PopActive();
}
}