From 51849f65e572da9a5aca2c42fda9584246af7186 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 12 Sep 2016 10:17:51 +0100 Subject: [PATCH] Refactored LuaScript to use ILuaScript interface --- .../Thirdparty/FungusLua/Scripts/ILuaScript.cs | 16 ++++++++++++++++ .../FungusLua/Scripts/ILuaScript.cs.meta | 12 ++++++++++++ .../Thirdparty/FungusLua/Scripts/LuaScript.cs | 6 +++++- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaScript.cs create mode 100644 Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaScript.cs.meta diff --git a/Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaScript.cs b/Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaScript.cs new file mode 100644 index 00000000..cf031c40 --- /dev/null +++ b/Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaScript.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +namespace Fungus +{ + /// + /// Executes Lua script defined in a string property or in an external file. + /// + public interface ILuaScript + { + /// + /// Execute the Lua script. + /// This is the function to call if you want to trigger execution from an external script. + /// + void OnExecute(); + } +} \ No newline at end of file diff --git a/Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaScript.cs.meta b/Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaScript.cs.meta new file mode 100644 index 00000000..749ac74a --- /dev/null +++ b/Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaScript.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: abbbc56988f804fc393471c69ca748cb +timeCreated: 1473671672 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaScript.cs b/Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaScript.cs index fa2ff7dd..491ebc9f 100644 --- a/Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaScript.cs +++ b/Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaScript.cs @@ -62,7 +62,7 @@ namespace Fungus return GetPath(current.parent) + "." + current.name; } - public void Start() + protected virtual void Start() { InitLuaScript(); } @@ -128,6 +128,8 @@ namespace Fungus return s; } + #region ILuaScript implementation + /// /// Execute the Lua script. /// This is the function to call if you want to trigger execution from an external script. @@ -146,5 +148,7 @@ namespace Fungus LuaEnv.RunLuaFunction(luaFunction, runAsCoroutine); } } + + #endregion } }