/// <summary> /// 释放对象 /// </summary> /// <param name="gameObject"></param> public void freeObject(EffectRenderObj obj) { if (obj != null) { if (!freeList.Contains(obj)) { freeList.Add(obj); } if (effectPoolObject != null) { obj.GetNode().Attach(effectPoolObject); } } }
static int GetNode(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); EffectRenderObj obj = (EffectRenderObj)ToLua.CheckObject(L, 1, typeof(EffectRenderObj)); Node o = obj.GetNode(); ToLua.PushObject(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// 获取对象 /// </summary> /// <returns></returns> public EffectRenderObj getObject() { EffectRenderObj go = null; if (freeList.Count > 0) { int index = freeList.Count - 1; go = freeList[index]; freeList.RemoveAt(index); if (go == null) { return(go); } else { go.GetNode().Detach(); return(go); } } else { return(go); } }