예제 #1
0
        public void Destroy()
        {
            if (luaState != null)
            {
                if (UpdateEvent != null)
                {
                    UpdateEvent.Dispose();
                    UpdateEvent = null;
                }

                if (LateUpdateEvent != null)
                {
                    LateUpdateEvent.Dispose();
                    LateUpdateEvent = null;
                }

                if (FixedUpdateEvent != null)
                {
                    FixedUpdateEvent.Dispose();
                    FixedUpdateEvent = null;
                }

                luaState = null;
            }
        }
예제 #2
0
        LuaBeatEvent GetEvent(string name)
        {
            LuaTable table = luaState.GetTable(name);

            if (table == null)
            {
                throw new LuaException(string.Format("Lua table {0} not exists", name));
            }

            LuaBeatEvent e = new LuaBeatEvent(table);

            table.Dispose();
            table = null;
            return(e);
        }
예제 #3
0
        internal void Start()
        {
            if (LuaConst.openToLuaLib)
            {
                try
                {
                    UpdateEvent      = GetEvent("UpdateBeat");
                    LateUpdateEvent  = GetEvent("LateUpdateBeat");
                    FixedUpdateEvent = GetEvent("FixedUpdateBeat");

                    UpdateFunc      = luaState.GetFunction("Update");
                    LateUpdateFunc  = luaState.GetFunction("LateUpdate");
                    FixedUpdateFunc = luaState.GetFunction("FixedUpdate");
                }
                catch (Exception e)
                {
                    //Destroy(this);
                    Destroy();
                }
            }
        }