From 7e0054b3635df2c1a1d6bae4c50e03799d4014b5 Mon Sep 17 00:00:00 2001 From: B-DeshiDev Date: Wed, 3 Apr 2024 11:32:38 +0600 Subject: [PATCH] Fix start node issues --- .../Runtime/Data/xNode/Graph/DialogueGraph.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Assets/Packages/com.studio23.ss2.dialoguesystem/Runtime/Data/xNode/Graph/DialogueGraph.cs b/Assets/Packages/com.studio23.ss2.dialoguesystem/Runtime/Data/xNode/Graph/DialogueGraph.cs index 71411ab..b3af421 100644 --- a/Assets/Packages/com.studio23.ss2.dialoguesystem/Runtime/Data/xNode/Graph/DialogueGraph.cs +++ b/Assets/Packages/com.studio23.ss2.dialoguesystem/Runtime/Data/xNode/Graph/DialogueGraph.cs @@ -47,12 +47,6 @@ public override Node AddNode(Type type) public bool TryGetDefaultTable(out TableReference defaultTableReference) { defaultTableReference = default; - var startNode = FindStartNode(); - if (startNode == null) - { - return false; - } - foreach (var node in nodes) { if (node is DialogueLineNodeBase dialogueLineNodeBase) @@ -133,11 +127,11 @@ public void HandleDialogueEnded() OnDialogueEnded?.Invoke(this); } - private void FindStartNode() + private DialogueStartNode FindStartNode() { if (_startNode != null) { - return; + return null; } foreach (var node in nodes) { @@ -145,10 +139,11 @@ private void FindStartNode() if (node is DialogueStartNode startNode) { _startNode = startNode; - return; + return startNode; } } + return null; Debug.LogError($"NO START NODE FOR DIALOGUE GRAPH {this}"); }