|
|
@ -251,23 +251,38 @@ namespace Fungus |
|
|
|
return b; |
|
|
|
return b; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Returns the named Block in the flowchart, or null if not found. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public virtual Block FindBlock(string blockName) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Block [] blocks = GetComponentsInChildren<Block>(); |
|
|
|
|
|
|
|
foreach (Block block in blocks) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (block.blockName == blockName) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return block; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Start running another Flowchart by executing a specific child block. |
|
|
|
* Start running another Flowchart by executing a specific child block. |
|
|
|
* The block must be in an idle state to be executed. |
|
|
|
* The block must be in an idle state to be executed. |
|
|
|
* Returns true if the Block started execution. |
|
|
|
* You can use this method in a UI event. e.g. to handle a button click. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public virtual bool ExecuteBlock(string blockName) |
|
|
|
public virtual void ExecuteBlock(string blockName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Block [] blocks = GetComponentsInChildren<Block>(); |
|
|
|
Block [] blocks = GetComponentsInChildren<Block>(); |
|
|
|
foreach (Block block in blocks) |
|
|
|
foreach (Block block in blocks) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (block.blockName == blockName) |
|
|
|
if (block.blockName == blockName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return ExecuteBlock(block); |
|
|
|
ExecuteBlock(block); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|