진행도에 따른 다음챕터 넘기기

This commit is contained in:
2026-07-14 18:10:13 +09:00
parent 2f95fc0667
commit 1b74e347bf
11 changed files with 169 additions and 4 deletions

View File

@@ -49,4 +49,8 @@ public class DialogNode : ScriptableObject
[Header("Story")]
[Tooltip("0이 아니면 이 노드 재생 시 화자(비우면 대화 주인 NPC)의 호감도를 이만큼 증감")]
public int Affection;
[Tooltip("0이 아니면 이 노드 재생 시 메인 진행도를 이만큼 증가. " +
"분기 끝 노드마다 다른 값을 주면 선택지에 따라 진행도를 다르게 줄 수 있다")]
public int Progress;
}

View File

@@ -425,6 +425,10 @@ private async Awaitable PlayNode(DialogNode node)
StoryManager.Instance.AddAffection(affectionTarget, node.Affection);
}
// 메인 진행도 증가 — 분기 끝 노드마다 다른 값을 주면 선택지에 따라 진행도가 달라진다
if (node.Progress != 0)
StoryManager.Instance.MainProgress += node.Progress;
// 전용 BGM: 설정돼 있으면 교체, 비어 있으면 기본 BGM으로 복귀
if (SoundManager.Instance != null)
{

View File

@@ -98,6 +98,7 @@ public override void OnImportAsset(AssetImportContext ctx)
dn.ForcePlayerLook = GetInputPortValue<bool>(gn.GetInputPortByName(DialogLineNode.PORT_FORCELOOK));
dn.WaitForInput = GetInputPortValue<bool>(gn.GetInputPortByName(DialogLineNode.PORT_WAITINPUT));
dn.Affection = GetInputPortValue<int>(gn.GetInputPortByName(DialogLineNode.PORT_AFFECTION));
dn.Progress = GetInputPortValue<int>(gn.GetInputPortByName(DialogLineNode.PORT_PROGRESS));
string eventKey = null;
line.GetNodeOptionByName(DialogLineNode.OPTION_EVENT_KEY)?.TryGetValue(out eventKey);
@@ -145,6 +146,7 @@ static void FillStagingNode(DialogStagingNode gn, DialogNode dn)
dn.LookAtPlayer = GetInputPortValue<bool>(gn.GetInputPortByName(DialogStagingNode.PORT_LOOKAT));
dn.ForcePlayerLook = GetInputPortValue<bool>(gn.GetInputPortByName(DialogStagingNode.PORT_FORCELOOK));
dn.Affection = GetInputPortValue<int>(gn.GetInputPortByName(DialogStagingNode.PORT_AFFECTION));
dn.Progress = GetInputPortValue<int>(gn.GetInputPortByName(DialogStagingNode.PORT_PROGRESS));
string eventKey = null;
gn.GetNodeOptionByName(DialogStagingNode.OPTION_EVENT_KEY)?.TryGetValue(out eventKey);

View File

@@ -28,6 +28,7 @@ internal class DialogLineNode : DialogGraphNode
public const string PORT_FORCELOOK = "ForcePlayerLook";
public const string PORT_WAITINPUT = "WaitForInput";
public const string PORT_AFFECTION = "Affection";
public const string PORT_PROGRESS = "Progress";
public const string PORT_QUESTION = "ChoiceQuestion";
public const string OPTION_CHOICE_COUNT = "ChoiceCount";
@@ -77,6 +78,8 @@ protected override void OnDefinePorts(IPortDefinitionContext context)
context.AddInputPort<bool>(PORT_WAITINPUT).WithDisplayName("Wait For Input").Build();
context.AddInputPort<int>(PORT_AFFECTION).WithDisplayName("Affection ±")
.WithTooltip("0이 아니면 이 대사 재생 시 화자(비우면 대화 주인 NPC)의 호감도를 이만큼 증감").Build();
context.AddInputPort<int>(PORT_PROGRESS).WithDisplayName("Progress +")
.WithTooltip("0이 아니면 이 대사 재생 시 메인 진행도를 이만큼 증가 (분기 끝 노드에 달아 선택지별로 다르게)").Build();
int choiceCount = 0;
GetNodeOptionByName(OPTION_CHOICE_COUNT)?.TryGetValue(out choiceCount);

View File

@@ -20,6 +20,7 @@ internal class DialogStagingNode : DialogGraphNode
public const string PORT_LOOKAT = "LookAtPlayer";
public const string PORT_FORCELOOK = "ForcePlayerLook";
public const string PORT_AFFECTION = "Affection";
public const string PORT_PROGRESS = "Progress";
public const string OPTION_EVENT_KEY = "EventKey";
@@ -51,6 +52,8 @@ protected override void OnDefinePorts(IPortDefinitionContext context)
.WithTooltip("플레이어가 대상 캐릭터를 바라봄").Build();
context.AddInputPort<int>(PORT_AFFECTION).WithDisplayName("Affection ±")
.WithTooltip("0이 아니면 이 연출 재생 시 대상(비우면 대화 주인 NPC)의 호감도를 이만큼 증감").Build();
context.AddInputPort<int>(PORT_PROGRESS).WithDisplayName("Progress +")
.WithTooltip("0이 아니면 이 연출 재생 시 메인 진행도를 이만큼 증가").Build();
AddExecOutput(context, EXEC_OUT, string.Empty);
}