Exemplo n.º 1
0
    //--------

    private void Awake()
    {
        if (null != singleton)
        {
            Destroy(gameObject);
            return;
        }
        singleton = this;

        DontDestroyOnLoad(gameObject);

        if (null == scriptFolder)
        {
            return;
        }
        lua = new MyLuaState();
        lua.Start();
        LuaBinder.Bind(lua);

        addSearchPath(lua, Application.dataPath + scriptFolder);

        lua.DoFile(engineFileName);

        engine                  = lua.GetTable("_Engine");
        func_engine_update      = engine.GetLuaFunction("update");
        func_engine_late_update = engine.GetLuaFunction("lateupdate");
    }
Exemplo n.º 2
0
    private void OnDestroy()
    {
        if (null != func_engine_update)
        {
            func_engine_update.Dispose();
            func_engine_update = null;
        }
        if (null != func_engine_late_update)
        {
            func_engine_late_update.Dispose();
            func_engine_late_update = null;
        }
        if (null != engine)
        {
            engine.Call("shutdown");

            engine.Dispose();
            engine = null;
        }
        if (null != lua)
        {
            lua.Dispose();
            lua = null;
        }
    }