Example #1
0
    public GameObject BorrowObj(string path)
    {
        bool                  retCode = false;
        GameObject            obj     = null;
        QObjPool <GameObject> pool    = null;

        m_pools.TryGetValue(path, out pool);
        if (pool == null)
        {
            //没有对应的pool就创建一个
            QObjPoolForParticle creator =
                new QObjPoolForParticle(path, 32);
            pool    = new QObjPool <GameObject>();
            retCode = pool.Init(creator, null);
            if (!retCode)
            {
                Debug.LogError("QObjPool 初始失败 " + path);
                return(obj);
            }
            m_pools.Add(path, pool);
        }

        obj = pool.BorrowObj();

        return(obj);
    }
Example #2
0
    private void InitBattleObjPool(string[] paths, BattleObjManager.E_BATTLE_OBJECT_TYPE type, int count)
    {
        QObjCreatorFactory <CharObj> creatorFactory = new CharObjCreatorFactory(
            paths, type, count);

        QObjPool <CharObj> pool = new QObjPool <CharObj>();

        pool.Init(null, creatorFactory);

        m_pools.Add(type, pool);
    }