Browse Source

Added StopFlowchart command

master
chrisgregan 10 years ago
parent
commit
929b56ea90
  1. 56
      Assets/Fungus/Flowchart/Scripts/Commands/StopFlowchart.cs
  2. 12
      Assets/Fungus/Flowchart/Scripts/Commands/StopFlowchart.cs.meta

56
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<Flowchart> targetFlowcharts = new List<Flowchart>();
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);
}
}
}

12
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:
Loading…
Cancel
Save