Browse Source

Initial version of Label and Jump commands

master
chrisgregan 10 years ago
parent
commit
57f99bcf02
  1. 41
      Assets/Fungus/FungusScript/Scripts/Commands/Jump.cs
  2. 8
      Assets/Fungus/FungusScript/Scripts/Commands/Jump.cs.meta
  3. 31
      Assets/Fungus/FungusScript/Scripts/Commands/Label.cs
  4. 8
      Assets/Fungus/FungusScript/Scripts/Commands/Label.cs.meta
  5. 37
      Assets/FungusExamples/Variables/Scenes/Variables.unity

41
Assets/Fungus/FungusScript/Scripts/Commands/Jump.cs

@ -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);
}
}
}

8
Assets/Fungus/FungusScript/Scripts/Commands/Jump.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ae9ac2fcbd1d542619ab0bc7549fb264
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

31
Assets/Fungus/FungusScript/Scripts/Commands/Label.cs

@ -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);
}
}
}

8
Assets/Fungus/FungusScript/Scripts/Commands/Label.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ea4da378c47144a86979765ac5e9690c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

37
Assets/FungusExamples/Variables/Scenes/Variables.unity

@ -335,6 +335,8 @@ GameObject:
- 114: {fileID: 1269704331} - 114: {fileID: 1269704331}
- 114: {fileID: 1269704332} - 114: {fileID: 1269704332}
- 114: {fileID: 1269704333} - 114: {fileID: 1269704333}
- 114: {fileID: 1269704335}
- 114: {fileID: 1269704334}
m_Layer: 0 m_Layer: 0
m_Name: RedScript m_Name: RedScript
m_TagString: Untagged m_TagString: Untagged
@ -406,6 +408,8 @@ MonoBehaviour:
runSlowInEditor: 1 runSlowInEditor: 1
eventHandler: {fileID: 1269704323} eventHandler: {fileID: 1269704323}
commandList: commandList:
- {fileID: 1269704334}
- {fileID: 1269704335}
- {fileID: 1269704324} - {fileID: 1269704324}
- {fileID: 1269704328} - {fileID: 1269704328}
- {fileID: 1269704322} - {fileID: 1269704322}
@ -438,8 +442,9 @@ MonoBehaviour:
y: -418 y: -418
width: 1213 width: 1213
height: 953 height: 953
selectedSequence: {fileID: 0} selectedSequence: {fileID: 1269704318}
selectedCommands: [] selectedCommands:
- {fileID: 1269704335}
variables: variables:
- {fileID: 1269704317} - {fileID: 1269704317}
- {fileID: 1269704316} - {fileID: 1269704316}
@ -706,6 +711,34 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
errorMessage: errorMessage:
indentLevel: 0 indentLevel: 0
--- !u!114 &1269704334
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1269704314}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ae9ac2fcbd1d542619ab0bc7549fb264, type: 3}
m_Name:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
labelName: Hi there
--- !u!114 &1269704335
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1269704314}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ea4da378c47144a86979765ac5e9690c, type: 3}
m_Name:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
labelName: Hi there
--- !u!1 &1671111970 --- !u!1 &1671111970
GameObject: GameObject:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

Loading…
Cancel
Save