chrisgregan
10 years ago
5 changed files with 123 additions and 2 deletions
@ -0,0 +1,41 @@
|
||||
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 |
||||
{ |
||||
public string labelName; |
||||
|
||||
public override void OnEnter() |
||||
{ |
||||
if (labelName.Length == 0) |
||||
{ |
||||
Continue(); |
||||
return; |
||||
} |
||||
|
||||
foreach (Command command in parentSequence.commandList) |
||||
{ |
||||
Label label = command as Label; |
||||
if (label != null && |
||||
label.labelName == labelName) |
||||
{ |
||||
Continue(label.commandIndex + 1); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public override Color GetButtonColor() |
||||
{ |
||||
return new Color32(253, 253, 150, 255); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: ae9ac2fcbd1d542619ab0bc7549fb264 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,31 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
[CommandInfo("Scripting", |
||||
"Label", |
||||
"Marks a position in the command list for execution to jump to.")] |
||||
[AddComponentMenu("")] |
||||
public class Label : Command |
||||
{ |
||||
public string labelName = ""; |
||||
|
||||
public override void OnEnter() |
||||
{ |
||||
Continue(); |
||||
} |
||||
|
||||
public override string GetSummary() |
||||
{ |
||||
return labelName; |
||||
} |
||||
|
||||
public override Color GetButtonColor() |
||||
{ |
||||
return new Color32(253, 253, 150, 255); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: ea4da378c47144a86979765ac5e9690c |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
Loading…
Reference in new issue