From 3bf341c684665a3fcc05ab985da286f5b458b346 Mon Sep 17 00:00:00 2001 From: CG-Tespy Date: Tue, 11 Feb 2020 05:16:49 -0500 Subject: [PATCH 1/2] Added GetVariables function --- Assets/Fungus/Scripts/Components/Flowchart.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Assets/Fungus/Scripts/Components/Flowchart.cs b/Assets/Fungus/Scripts/Components/Flowchart.cs index b4071dad..ae8316d0 100644 --- a/Assets/Fungus/Scripts/Components/Flowchart.cs +++ b/Assets/Fungus/Scripts/Components/Flowchart.cs @@ -800,6 +800,23 @@ namespace Fungus return null; } + /// + /// Returns a list of variables matching the specified type. + /// + public IList GetVariables() where T: Variable + { + var varsFound = new List(); + + for (int i = 0; i < Variables.Count; i++) + { + var currentVar = Variables[i]; + if (currentVar is T) + varsFound.Add(currentVar as T); + } + + return varsFound; + } + /// /// Register a new variable with the Flowchart at runtime. /// The variable should be added as a component on the Flowchart game object. From b313ab9db0ac10e6816aa15cc9f66c0f6d28d925 Mon Sep 17 00:00:00 2001 From: CG-Tespy Date: Wed, 12 Feb 2020 06:37:57 -0500 Subject: [PATCH 2/2] Applied requested changed to GetVariables method --- Assets/Fungus/Scripts/Components/Flowchart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Fungus/Scripts/Components/Flowchart.cs b/Assets/Fungus/Scripts/Components/Flowchart.cs index ae8316d0..2b91a972 100644 --- a/Assets/Fungus/Scripts/Components/Flowchart.cs +++ b/Assets/Fungus/Scripts/Components/Flowchart.cs @@ -803,7 +803,7 @@ namespace Fungus /// /// Returns a list of variables matching the specified type. /// - public IList GetVariables() where T: Variable + public virtual List GetVariables() where T: Variable { var varsFound = new List();