From 1635d471c02ac7892111deec415218795c63fb7c Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 14 Jan 2016 16:59:53 +0000 Subject: [PATCH] Added HasExecutingBlocks() and GetExecutingBlocks() --- Assets/Fungus/Flowchart/Scripts/Flowchart.cs | 35 ++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs index 9691232b..c223a8f4 100644 --- a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs +++ b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs @@ -880,6 +880,41 @@ namespace Fungus return true; } + /** + * Returns true if there are any executing blocks in this Flowchart. + */ + public virtual bool HasExecutingBlocks() + { + Block[] blocks = GetComponentsInChildren(); + foreach (Block block in blocks) + { + if (block.IsExecuting()) + { + return true; + } + } + return false; + } + + /** + * Returns a list of all executing blocks in this Flowchart. + */ + public virtual List GetExecutingBlocks() + { + List executingBlocks = new List(); + + Block[] blocks = GetComponentsInChildren(); + foreach (Block block in blocks) + { + if (block.IsExecuting()) + { + executingBlocks.Add(block); + } + } + + return executingBlocks; + } + public virtual string SubstituteVariables(string text) { string subbedText = text;