Ejemplo n.º 1
0
        protected void Awake()
        {
            if (luaPath == "")
            {
                Debug.LogError("### LuaBehaviour Error, Empty luaPath :" + name);
            }

            if (luaName == "")
            {
                Debug.LogError("### LuaBehaviour Error, Empty luaName :" + name);
            }

            LuaManager luaMgr = AppFacade.Instance.GetManager <LuaManager>(ManagerName.Lua);
            object     luaRet = luaMgr.Require <object>(luaPath);

            mSelfTable = luaRet as LuaTable;

            if (mSelfTable == null)
            {
                Debug.LogError("Lua must return a table " + luaPath);
            }
            awake      = mSelfTable.GetLuaFunction("Awake");
            start      = mSelfTable.GetLuaFunction("Start");
            on_enable  = mSelfTable.GetLuaFunction("OnEnable");
            update     = mSelfTable.GetLuaFunction("Update");
            on_destroy = mSelfTable.GetLuaFunction("OnDestroy");
            Util.CallLuaFunction(awake, mSelfTable, gameObject);
        }