|
|
@ -169,13 +169,13 @@ namespace Fungus |
|
|
|
public int NextItemId() |
|
|
|
public int NextItemId() |
|
|
|
{ |
|
|
|
{ |
|
|
|
int maxId = -1; |
|
|
|
int maxId = -1; |
|
|
|
Block[] blocks = GetComponentsInChildren<Block>(); |
|
|
|
Block[] blocks = GetComponents<Block>(); |
|
|
|
foreach (Block block in blocks) |
|
|
|
foreach (Block block in blocks) |
|
|
|
{ |
|
|
|
{ |
|
|
|
maxId = Math.Max(maxId, block.itemId); |
|
|
|
maxId = Math.Max(maxId, block.itemId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Command[] commands = GetComponentsInChildren<Command>(); |
|
|
|
Command[] commands = GetComponents<Command>(); |
|
|
|
foreach (Command command in commands) |
|
|
|
foreach (Command command in commands) |
|
|
|
{ |
|
|
|
{ |
|
|
|
maxId = Math.Max(maxId, command.itemId); |
|
|
|
maxId = Math.Max(maxId, command.itemId); |
|
|
@ -275,7 +275,7 @@ namespace Fungus |
|
|
|
// Make sure item ids are unique and monotonically increasing. |
|
|
|
// Make sure item ids are unique and monotonically increasing. |
|
|
|
// This should always be the case, but some legacy Flowcharts may have issues. |
|
|
|
// This should always be the case, but some legacy Flowcharts may have issues. |
|
|
|
List<int> usedIds = new List<int>(); |
|
|
|
List<int> usedIds = new List<int>(); |
|
|
|
Block[] blocks = GetComponentsInChildren<Block>(); |
|
|
|
Block[] blocks = GetComponents<Block>(); |
|
|
|
foreach (Block block in blocks) |
|
|
|
foreach (Block block in blocks) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (block.itemId == -1 || |
|
|
|
if (block.itemId == -1 || |
|
|
@ -286,7 +286,7 @@ namespace Fungus |
|
|
|
usedIds.Add(block.itemId); |
|
|
|
usedIds.Add(block.itemId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Command[] commands = GetComponentsInChildren<Command>(); |
|
|
|
Command[] commands = GetComponents<Command>(); |
|
|
|
foreach (Command command in commands) |
|
|
|
foreach (Command command in commands) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (command.itemId == -1 || |
|
|
|
if (command.itemId == -1 || |
|
|
@ -304,7 +304,7 @@ namespace Fungus |
|
|
|
// Unreferenced components don't have any effect on the flowchart behavior, but |
|
|
|
// Unreferenced components don't have any effect on the flowchart behavior, but |
|
|
|
// they waste memory so should be cleared out periodically. |
|
|
|
// they waste memory so should be cleared out periodically. |
|
|
|
|
|
|
|
|
|
|
|
Block[] blocks = GetComponentsInChildren<Block>(); |
|
|
|
Block[] blocks = GetComponents<Block>(); |
|
|
|
|
|
|
|
|
|
|
|
// Remove any null entries in the variables list |
|
|
|
// Remove any null entries in the variables list |
|
|
|
// It shouldn't happen but it seemed to occur for a user on the forum |
|
|
|
// It shouldn't happen but it seemed to occur for a user on the forum |
|
|
@ -380,7 +380,7 @@ namespace Fungus |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public virtual Block FindBlock(string blockName) |
|
|
|
public virtual Block FindBlock(string blockName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Block [] blocks = GetComponentsInChildren<Block>(); |
|
|
|
Block [] blocks = GetComponents<Block>(); |
|
|
|
foreach (Block block in blocks) |
|
|
|
foreach (Block block in blocks) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (block.blockName == blockName) |
|
|
|
if (block.blockName == blockName) |
|
|
@ -400,7 +400,7 @@ namespace Fungus |
|
|
|
public virtual bool ExecuteBlock(string blockName) |
|
|
|
public virtual bool ExecuteBlock(string blockName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Block block = null; |
|
|
|
Block block = null; |
|
|
|
foreach (Block b in GetComponentsInChildren<Block>()) |
|
|
|
foreach (Block b in GetComponents<Block>()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (b.blockName == blockName) |
|
|
|
if (b.blockName == blockName) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -455,7 +455,7 @@ namespace Fungus |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public virtual void StopAllBlocks() |
|
|
|
public virtual void StopAllBlocks() |
|
|
|
{ |
|
|
|
{ |
|
|
|
Block [] blocks = GetComponentsInChildren<Block>(); |
|
|
|
Block [] blocks = GetComponents<Block>(); |
|
|
|
foreach (Block block in blocks) |
|
|
|
foreach (Block block in blocks) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (block.IsExecuting()) |
|
|
|
if (block.IsExecuting()) |
|
|
@ -471,7 +471,7 @@ namespace Fungus |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public virtual void SendFungusMessage(string messageName) |
|
|
|
public virtual void SendFungusMessage(string messageName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
MessageReceived[] eventHandlers = GetComponentsInChildren<MessageReceived>(); |
|
|
|
MessageReceived[] eventHandlers = GetComponents<MessageReceived>(); |
|
|
|
foreach (MessageReceived eventHandler in eventHandlers) |
|
|
|
foreach (MessageReceived eventHandler in eventHandlers) |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventHandler.OnSendFungusMessage(messageName); |
|
|
|
eventHandler.OnSendFungusMessage(messageName); |
|
|
@ -554,7 +554,7 @@ namespace Fungus |
|
|
|
baseKey = "New Block"; |
|
|
|
baseKey = "New Block"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Block[] blocks = GetComponentsInChildren<Block>(); |
|
|
|
Block[] blocks = GetComponents<Block>(); |
|
|
|
|
|
|
|
|
|
|
|
string key = baseKey; |
|
|
|
string key = baseKey; |
|
|
|
while (true) |
|
|
|
while (true) |
|
|
@ -837,7 +837,7 @@ namespace Fungus |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (hideComponents) |
|
|
|
if (hideComponents) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Block[] blocks = GetComponentsInChildren<Block>(); |
|
|
|
Block[] blocks = GetComponents<Block>(); |
|
|
|
foreach (Block block in blocks) |
|
|
|
foreach (Block block in blocks) |
|
|
|
{ |
|
|
|
{ |
|
|
|
block.hideFlags = HideFlags.HideInInspector; |
|
|
|
block.hideFlags = HideFlags.HideInInspector; |
|
|
@ -847,13 +847,13 @@ namespace Fungus |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Command[] commands = GetComponentsInChildren<Command>(); |
|
|
|
Command[] commands = GetComponents<Command>(); |
|
|
|
foreach (Command command in commands) |
|
|
|
foreach (Command command in commands) |
|
|
|
{ |
|
|
|
{ |
|
|
|
command.hideFlags = HideFlags.HideInInspector; |
|
|
|
command.hideFlags = HideFlags.HideInInspector; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
EventHandler[] eventHandlers = GetComponentsInChildren<EventHandler>(); |
|
|
|
EventHandler[] eventHandlers = GetComponents<EventHandler>(); |
|
|
|
foreach (EventHandler eventHandler in eventHandlers) |
|
|
|
foreach (EventHandler eventHandler in eventHandlers) |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventHandler.hideFlags = HideFlags.HideInInspector; |
|
|
|
eventHandler.hideFlags = HideFlags.HideInInspector; |
|
|
@ -861,7 +861,7 @@ namespace Fungus |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
MonoBehaviour[] monoBehaviours = GetComponentsInChildren<MonoBehaviour>(); |
|
|
|
MonoBehaviour[] monoBehaviours = GetComponents<MonoBehaviour>(); |
|
|
|
foreach (MonoBehaviour monoBehaviour in monoBehaviours) |
|
|
|
foreach (MonoBehaviour monoBehaviour in monoBehaviours) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (monoBehaviour == null) |
|
|
|
if (monoBehaviour == null) |
|
|
@ -893,7 +893,7 @@ namespace Fungus |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (resetCommands) |
|
|
|
if (resetCommands) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Command[] commands = GetComponentsInChildren<Command>(); |
|
|
|
Command[] commands = GetComponents<Command>(); |
|
|
|
foreach (Command command in commands) |
|
|
|
foreach (Command command in commands) |
|
|
|
{ |
|
|
|
{ |
|
|
|
command.OnReset(); |
|
|
|
command.OnReset(); |
|
|
@ -932,7 +932,7 @@ namespace Fungus |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public virtual bool HasExecutingBlocks() |
|
|
|
public virtual bool HasExecutingBlocks() |
|
|
|
{ |
|
|
|
{ |
|
|
|
Block[] blocks = GetComponentsInChildren<Block>(); |
|
|
|
Block[] blocks = GetComponents<Block>(); |
|
|
|
foreach (Block block in blocks) |
|
|
|
foreach (Block block in blocks) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (block.IsExecuting()) |
|
|
|
if (block.IsExecuting()) |
|
|
@ -950,7 +950,7 @@ namespace Fungus |
|
|
|
{ |
|
|
|
{ |
|
|
|
List<Block> executingBlocks = new List<Block>(); |
|
|
|
List<Block> executingBlocks = new List<Block>(); |
|
|
|
|
|
|
|
|
|
|
|
Block[] blocks = GetComponentsInChildren<Block>(); |
|
|
|
Block[] blocks = GetComponents<Block>(); |
|
|
|
foreach (Block block in blocks) |
|
|
|
foreach (Block block in blocks) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (block.IsExecuting()) |
|
|
|
if (block.IsExecuting()) |
|
|
|