Example #1
0
    public static int RemoveTimer(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(int)))
        {
            GameObject obj = LuaScriptMgr.GetUnityObject <GameObject>(L, 1);
            if (obj == null)
            {
                HobaDebuger.LogError("RemoveTimer: param 1 must be GameObject");
                return(GameUtilWrap.CheckReturnNum(L, count, nRet));
            }

            ObjectBehaviour comp = obj.GetComponent <ObjectBehaviour>();
            if (comp == null)
            {
                HobaDebuger.LogError("RemoveTimer: param 1 must have ObjectBehaviour");
                return(GameUtilWrap.CheckReturnNum(L, count, nRet));
            }

            int id = (int)LuaScriptMgr.GetNumber(L, 2);
            comp.RemoveTimer(id);
            return(GameUtilWrap.CheckReturnNum(L, count, nRet));
        }
        else
        {
            LogParamError("RemoveTimer", count);
            return(GameUtilWrap.CheckReturnNum(L, count, nRet));
        }
    }