chrisgregan
11 years ago
3 changed files with 78 additions and 1 deletions
@ -0,0 +1,34 @@
|
||||
using UnityEditor; |
||||
using UnityEngine; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Fungus.Script |
||||
{ |
||||
|
||||
[CustomEditor (typeof(Call))] |
||||
public class CallEditor : FungusCommandEditor |
||||
{ |
||||
public override void DrawCommandGUI() |
||||
{ |
||||
Call t = target as Call; |
||||
|
||||
FungusScript fungusScript = t.GetFungusScript(); |
||||
if (fungusScript == null) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
Sequence targetSequence = SequenceEditor.SequenceField(new GUIContent("Target Sequence", "Sequence to call"), |
||||
new GUIContent("<Continue>"), |
||||
fungusScript, |
||||
t.targetSequence); |
||||
if (targetSequence != t.targetSequence) |
||||
{ |
||||
Undo.RecordObject(t, "Set Target Sequence"); |
||||
t.targetSequence = targetSequence; |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,43 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Fungus.Script |
||||
{ |
||||
[HelpText("Execute another sequence.")] |
||||
public class Call : FungusCommand |
||||
{ |
||||
public Sequence targetSequence; |
||||
|
||||
public override void OnEnter() |
||||
{ |
||||
if (targetSequence != null) |
||||
{ |
||||
ExecuteSequence(targetSequence); |
||||
} |
||||
else |
||||
{ |
||||
Continue(); |
||||
} |
||||
} |
||||
|
||||
public override void GetConnectedSequences(ref List<Sequence> connectedSequences) |
||||
{ |
||||
if (targetSequence != null) |
||||
{ |
||||
connectedSequences.Add(targetSequence); |
||||
} |
||||
} |
||||
|
||||
public override string GetSummary() |
||||
{ |
||||
if (targetSequence == null) |
||||
{ |
||||
return "<Continue> (No sequence selected)"; |
||||
} |
||||
|
||||
return targetSequence.name; |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue