글로벌 오브젝트 추가

This commit is contained in:
2026-07-30 12:46:37 +09:00
parent 073567c652
commit 2413483853
23 changed files with 425 additions and 51 deletions

View File

@@ -185,14 +185,25 @@ private async Awaitable<StoryBeat> SelectBeat(List<StoryBeat> playable)
private async Awaitable PlayBeat(StoryBeat beat)
{
// 도달한 종료 노드가 정한다. 중간에 끊기면(씬 전환 등) false로 남아 장소 BGM으로 복귀한다.
bool keepBgmOnEnd = false;
try
{
var node = beat.Group.StartNode;
int routingHops = 0; // 연속 라우팅 횟수 — 라우팅 노드끼리 순환하면 대기 없는 무한 루프가 되므로 차단
while (node != null)
{
// 종료 노드 — 대화를 끝낸다. 분기마다 다른 종료 노드를 둘 수 있어서
// "이 루트는 BGM 유지, 저 루트는 복귀"가 각각 정해진다.
if (node.Kind == DialogNodeKind.End)
{
keepBgmOnEnd = node.KeepBgmOnEnd;
break;
}
// 호감도 라우팅 노드 — 대사 없이 즉시 분기 (플레이어에겐 분기 자체가 보이지 않는다)
if (node.AffectionCheck)
if (node.Kind == DialogNodeKind.AffectionCheck)
{
if (++routingHops > 100)
{
@@ -254,8 +265,12 @@ private async Awaitable PlayBeat(StoryBeat beat)
{
if (DialogHud.Instance != null)
DialogHud.Instance.Hide();
if (SoundManager.Instance != null)
SoundManager.Instance.ClearOverrideBGM(); // 대화가 끝나면 기본 BGM으로 복귀
// 대화 BGM 처리 — 도달한 종료 노드가 Keep BGM이면 마지막 곡을 그대로 유지하고,
// 아니면 장소 BGM으로 복귀한다.
if (SoundManager.Instance != null && !keepBgmOnEnd)
SoundManager.Instance.ClearOverrideBGM();
RestoreDefaultAnimations();
}
}
@@ -303,14 +318,14 @@ private async Awaitable<bool> PlayNode(DialogNode node)
if (node.Progress != 0)
StoryManager.Instance.MainProgress += node.Progress;
// 전용 BGM: 설정돼 있으면 교체, 비어 있으면 기본 BGM으로 복귀
if (SoundManager.Instance != null)
{
if (node.Bgm != null)
SoundManager.Instance.PlayOverrideBGM(node.Bgm);
else
SoundManager.Instance.ClearOverrideBGM();
}
// BGM: 지정된 노드에서만 갈아타고, 다시 바꾸기 전까지 계속 이어진다.
// 비어 있으면 "변경 없음" — 모든 노드에 같은 곡을 넣어줄 필요가 없다.
if (node.Bgm != null && SoundManager.Instance != null)
SoundManager.Instance.PlayOverrideBGM(node.Bgm);
// 1회성 효과음 — 이 대사가 뜨는 순간 한 번 재생된다
if (node.Sfx != null && SoundManager.Instance != null)
SoundManager.Instance.PlaySFX(node.Sfx);
// 보이스 재생
if (node.Voice != null && node.Speaker != null)