You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.1 KiB
56 lines
1.1 KiB
9 years ago
|
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);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|