Exemplo n.º 1
0
    public Pool(PoolAble obj, int nbObj, int extend)
    {
        _list = new List<PoolAble>();
        _extend = (extend <= 0 ? 1 : extend);
        _objectBase = obj;

        AddObject(nbObj);
    }
Exemplo n.º 2
0
    public void Push(PoolAble poolAble)
    {
        string name = poolAble.gameObject.name;

        if (pool.ContainsKey(name) == false)
        {
            Object.Destroy(poolAble.gameObject);
            return;
        }

        pool[name].Push(poolAble);
    }
Exemplo n.º 3
0
        public void Push(PoolAble poolAble)
        {
            if (poolAble == null)
            {
                return;
            }

            poolAble.transform.parent = Root;
            poolAble.gameObject.SetActive(false);
            poolAble.isUsing = false;

            poolStack.Push(poolAble);
        }
Exemplo n.º 4
0
    public void Destroy(GameObject obj, float time)
    {
        if (obj != null)
        {
            PoolAble poolAble = obj.GetComponent <PoolAble>();

            if (poolAble != null)
            {
                Managers.Pool.Push(poolAble);
                return;
            }

            Object.Destroy(obj, time);
        }
    }