diff --git a/Assets/Fungus/FungusScript/Commands/RunScript.cs b/Assets/Fungus/FungusScript/Commands/RunScript.cs new file mode 100644 index 00000000..048a1732 --- /dev/null +++ b/Assets/Fungus/FungusScript/Commands/RunScript.cs @@ -0,0 +1,48 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + +namespace Fungus +{ + [CommandInfo("Scripting", + "Run Script", + "Start executing another Fungus Script.")] + public class RunScript : Command + { + public FungusScript targetFungusScript; + + public bool stopCurrentScript = true; + + public override void OnEnter() + { + if (targetFungusScript != null) + { + if (stopCurrentScript) + { + Stop(); + } + targetFungusScript.Execute(); + } + else + { + Continue(); + } + } + + public override string GetSummary() + { + if (targetFungusScript == null) + { + return ""; + } + + return targetFungusScript.name; + } + + public override Color GetButtonColor() + { + return new Color32(235, 191, 217, 255); + } + } + +} \ No newline at end of file diff --git a/Assets/Fungus/FungusScript/Commands/RunScript.cs.meta b/Assets/Fungus/FungusScript/Commands/RunScript.cs.meta new file mode 100644 index 00000000..74deeed5 --- /dev/null +++ b/Assets/Fungus/FungusScript/Commands/RunScript.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bd63e1ab17e844866b85f8574fa073ee +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: