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.
51 lines
874 B
51 lines
874 B
10 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace Fungus
|
||
|
{
|
||
|
[CommandInfo("Scripting",
|
||
|
"Jump",
|
||
|
"Move execution to a specific Label command")]
|
||
|
[AddComponentMenu("")]
|
||
|
public class Jump : Command
|
||
|
{
|
||
10 years ago
|
public Label targetLabel;
|
||
10 years ago
|
|
||
|
public override void OnEnter()
|
||
|
{
|
||
10 years ago
|
if (targetLabel == null)
|
||
10 years ago
|
{
|
||
|
Continue();
|
||
|
return;
|
||
|
}
|
||
|
|
||
10 years ago
|
foreach (Command command in parentBlock.commandList)
|
||
10 years ago
|
{
|
||
|
Label label = command as Label;
|
||
|
if (label != null &&
|
||
10 years ago
|
label == targetLabel)
|
||
10 years ago
|
{
|
||
|
Continue(label.commandIndex + 1);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
10 years ago
|
public override string GetSummary()
|
||
|
{
|
||
|
if (targetLabel == null)
|
||
|
{
|
||
|
return "Error: No label selected";
|
||
|
}
|
||
|
|
||
10 years ago
|
return targetLabel.key;
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
public override Color GetButtonColor()
|
||
|
{
|
||
|
return new Color32(253, 253, 150, 255);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|