대화 시작시 기본회전 막기 옵션 추가

This commit is contained in:
2026-07-23 15:06:05 +09:00
parent de5fe5b85a
commit c3a8d1ce2e
8 changed files with 134 additions and 23 deletions

View File

@@ -23,6 +23,10 @@ public struct DialogEntry
[Tooltip("대화 선택 메뉴에 표시할 이름 (비우면 그룹 이름 사용)")]
public string MenuLabel;
[Tooltip("켜면 이 대화에선 말을 걸어도 플레이어 쪽으로 회전하지 않는다 (기본: 회전함). " +
"정면을 고정한 연출 대화 등에 사용. 단, 선택 메뉴가 뜨는 다중 대화에선 메뉴를 위해 회전할 수 있음")]
public bool DontRotateToPlayer;
}
// 노드의 EventKey ↔ 그 노드 재생 시 호출할 이벤트.
@@ -130,8 +134,15 @@ public async Awaitable Play()
// 말을 걸면 NPC가 플레이어 쪽으로 돌아본다 — 대화창(선택 메뉴·첫 대사)이 NPC 회전을
// 따라가므로 창도 플레이어를 향하게 된다. 원래 회전은 아래 finally에서 복원.
_originalRotations.TryAdd(transform, GetOriginalRotation(transform));
RotateTowardPlayer(transform);
// 단, 대화 항목이 하나이고 그 항목이 DontRotateToPlayer면 회전하지 않는다(정면 고정 연출 등).
// 여러 개(선택 메뉴)일 땐 메뉴가 플레이어를 향하도록 우선 회전한다.
bool singleEntry = playable.Count == 1;
bool rotateToPlayer = !singleEntry || !_dialogs[playable[0]].DontRotateToPlayer;
if (rotateToPlayer)
{
_originalRotations.TryAdd(transform, GetOriginalRotation(transform));
RotateTowardPlayer(transform);
}
// 대화창이 바로 튀어나오지 않도록 잠깐 뜸을 들인다 (선택 메뉴·첫 대사 공통)
if (_dialogStartDelay > 0f)
@@ -140,7 +151,7 @@ public async Awaitable Play()
if (_entryInProgress != null) return; // 기다리는 사이 다른 NPC의 대화가 시작됨
}
int index = playable.Count == 1 ? playable[0] : await SelectDialog(playable);
int index = singleEntry ? playable[0] : await SelectDialog(playable);
if (index < 0) return; // 선택 대기 중 취소됨 (다른 NPC와 대화 시작, 씬 전환 등)
_entryInProgress = this; // 여기서부터 실제 대사 재생 — 끝날 때까지 다른 NPC 상호작용 무시
@@ -187,8 +198,11 @@ private async Awaitable PlayGroupForced(DialogGroup group)
if (entry.Group == null)
entry = new DialogEntry { Group = group };
_originalRotations.TryAdd(transform, GetOriginalRotation(transform));
RotateTowardPlayer(transform);
if (!entry.DontRotateToPlayer)
{
_originalRotations.TryAdd(transform, GetOriginalRotation(transform));
RotateTowardPlayer(transform);
}
if (_dialogStartDelay > 0f)
{