public Event(Events e) { IsExclusive = false; ElapsedTime = 0; lua = new Lua(); lua["event"] = this; if (GameObject.Find("Player") != null) lua["player"] = GameObject.Find("Player").GetComponent<PlayerController>(); if (GameObject.Find("Manager").GetComponent<StageScript>() != null) lua["stage"] = GameObject.Find("Manager").GetComponent<StageScript>(); lua.DoString(Resources.Load<TextAsset>(SOURCE_FILE_FOLDER + "Utilities.lua").text); lua.DoString(GetLuaSource(e)); coroutine = new LuaCoroutine(lua); }
public static string GetLuaSource(Events e) { string filename = e.ToString(); TextAsset asset = Resources.Load<TextAsset>(SOURCE_FILE_FOLDER + filename + ".lua"); return asset.text; }