LuaInterface.LuaObjectPool.Add C# (CSharp) Method

Add() public method

public Add ( object obj ) : int
obj object
return int
        public int Add(object obj)
        {
            int pos = -1;

            if (head.index != 0)
            {
                pos = head.index;
                list[pos].obj = obj;
                head.index = list[pos].index;
            }
            else
            {
                pos = list.Count;
                list.Add(new PoolNode(pos, obj));
                count = pos + 1;
            }

            return pos;
        }

Usage Example

示例#1
0
        public int AddObject <T>(T obj)
        {
            int pos = 0;

            objects.Add(obj, out pos);
            return(pos);
        }
All Usage Examples Of LuaInterface.LuaObjectPool::Add