diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/StopFlowchart.cs b/Assets/Fungus/Flowchart/Scripts/Commands/StopFlowchart.cs new file mode 100644 index 00000000..e1a99e02 --- /dev/null +++ b/Assets/Fungus/Flowchart/Scripts/Commands/StopFlowchart.cs @@ -0,0 +1,56 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + +namespace Fungus +{ + [CommandInfo("Flow", + "Stop Flowchart", + "Stops execution of all Blocks in a Flowchart")] + [AddComponentMenu("")] + public class StopFlowchart : Command + { + [Tooltip("Stop all executing Blocks in the Flowchart that contains this command")] + public bool stopParentFlowchart; + + [Tooltip("Stop all executing Blocks in a list of target Flowcharts")] + public List targetFlowcharts = new List(); + + public override void OnEnter() + { + Flowchart flowchart = GetFlowchart(); + + if (stopParentFlowchart) + { + flowchart.StopAllBlocks(); + } + + foreach (Flowchart f in targetFlowcharts) + { + if (f == flowchart) + { + // Flowchart has already been stopped + continue; + } + + f.StopAllBlocks(); + } + } + + public override bool IsReorderableArray(string propertyName) + { + if (propertyName == "targetFlowcharts") + { + return true; + } + + return false; + } + + public override Color GetButtonColor() + { + return new Color32(235, 191, 217, 255); + } + } + +} \ No newline at end of file diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/StopFlowchart.cs.meta b/Assets/Fungus/Flowchart/Scripts/Commands/StopFlowchart.cs.meta new file mode 100644 index 00000000..c528201e --- /dev/null +++ b/Assets/Fungus/Flowchart/Scripts/Commands/StopFlowchart.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ae67a23cb4aa74793b41258ae40bf321 +timeCreated: 1442408419 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: