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.
40 lines
888 B
40 lines
888 B
10 years ago
|
using UnityEngine;
|
||
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace Fungus
|
||
|
{
|
||
|
[CommandInfo("Scripting",
|
||
|
"Break",
|
||
|
"Force a loop to terminate immediately.")]
|
||
|
[AddComponentMenu("")]
|
||
|
public class Break : Command
|
||
|
{
|
||
|
public override void OnEnter()
|
||
|
{
|
||
|
// Find next End statement at -1 relative indent level
|
||
10 years ago
|
for (int i = commandIndex + 1; i < parentBlock.commandList.Count; ++i)
|
||
10 years ago
|
{
|
||
10 years ago
|
End endCommand = parentBlock.commandList[i] as End;
|
||
10 years ago
|
|
||
|
if (endCommand != null &&
|
||
|
endCommand.indentLevel == indentLevel - 1)
|
||
|
{
|
||
|
// Continue at next command after End
|
||
|
Continue (endCommand.commandIndex + 1);
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// No matching End command found so just continue
|
||
|
Continue();
|
||
|
}
|
||
|
|
||
|
public override Color GetButtonColor()
|
||
|
{
|
||
|
return new Color32(253, 253, 150, 255);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|