Browse Source

Blocks and 1st command select automatically when executed

master
chrisgregan 10 years ago
parent
commit
4e1ee2e123
  1. 17
      Assets/Fungus/Flowchart/Scripts/Block.cs

17
Assets/Fungus/Flowchart/Scripts/Block.cs

@ -158,18 +158,12 @@ namespace Fungus
executionState = ExecutionState.Executing; executionState = ExecutionState.Executing;
#if UNITY_EDITOR #if UNITY_EDITOR
// If no block is currently executing, then automatically select this block for display in the inspector. // Select the executing block & the first command
bool found = false; flowchart.selectedBlock = this;
foreach (Block block in flowchart.GetComponentsInChildren<Block>()) if (commandList.Count > 0)
{ {
if (block.executionState == ExecutionState.Executing) flowchart.ClearSelectedCommands();
{ flowchart.AddSelectedCommand(commandList[0]);
found = true;
}
}
if (found)
{
flowchart.selectedBlock = this;
} }
#endif #endif
@ -245,7 +239,6 @@ namespace Fungus
executionState = ExecutionState.Idle; executionState = ExecutionState.Idle;
activeCommand = null; activeCommand = null;
flowchart.ClearSelectedCommands();
} }
public virtual void Stop() public virtual void Stop()

Loading…
Cancel
Save