멸망엔딩

This commit is contained in:
2026-07-24 12:08:24 +09:00
parent ffa6320e4d
commit ad15f47c75
28 changed files with 2140 additions and 10 deletions

View File

@@ -281,8 +281,22 @@ private async Awaitable PlayEntry(DialogEntry entry)
try
{
var node = entry.Group.StartNode;
int routingHops = 0; // 연속 라우팅 횟수 — 라우팅 노드끼리 순환하면 대기 없는 무한 루프가 되므로 차단
while (node != null)
{
// 호감도 라우팅 노드 — 대사 없이 즉시 분기 (플레이어에겐 분기 자체가 보이지 않는다)
if (node.AffectionCheck)
{
if (++routingHops > 100)
{
Debug.LogError($"[DialogPlayer] 라우팅 노드가 순환합니다 — 대화 중단: {entry.Group.name}");
break;
}
node = IsAffectionMet(node) ? node.AffectionPassBranch : node.Next;
continue;
}
routingHops = 0; // 실제 대사 노드에 도달 — 카운터 리셋
// 이 노드가 히든 분기를 가지면, 노드가 재생되는 동안 제스처 감시를 무장한다.
// (무장 안 된 노드는 아래 대기/선택이 기존과 완전히 동일하게 동작)
bool armed = node.HiddenBranch != null;
@@ -604,6 +618,39 @@ private async Awaitable<bool> PlayNode(DialogNode node)
return false;
}
// 호감도 분기 노드의 조건식 평가.
// 각 조건의 JoinWithNext로 이어 붙이며, AND가 OR보다 우선순위가 높다:
// A and B or C → (A and B) or C
// 즉 "AND 그룹들을 OR로 합치는" 형태로 계산한다. 조건이 없으면 통과로 본다.
private bool IsAffectionMet(DialogNode node)
{
var requirements = node.AffectionRequirements;
if (requirements == null || requirements.Count == 0) return true;
var story = StoryManager.Instance;
bool result = false; // 지금까지 닫힌 AND 그룹들을 OR로 합친 값
bool group = true; // 현재 진행 중인 AND 그룹
for (int i = 0; i < requirements.Count; i++)
{
var req = requirements[i];
if (req == null) continue;
var target = req.Character != null ? req.Character : _voice.Character;
group &= req.IsMet(story.GetAffection(target));
// 다음 연결자가 OR이거나 마지막이면 AND 그룹을 닫고 OR로 합친다
bool isLast = i == requirements.Count - 1;
if (isLast || req.JoinWithNext == AffectionJoin.Or)
{
result |= group;
group = true;
}
}
return result;
}
// 노드의 EventKey와 같은 Key를 가진 이벤트들을 호출
private void RaiseNodeEvent(string key)
{