Exemple #1
0
 private void RemoveFromSpawnedDic(IzPoolObject izPoolObject)
 {
     if (izPoolObject != null && this._strPoolName == izPoolObject.GetPoolName())
     {
         string           strPathName = izPoolObject.GetPathName();
         List <Transform> list        = null;
         if (this._dicSpawned.TryGetValue(strPathName, out list) && list != null)
         {
             list.Remove(izPoolObject.GetTransform());
             this._dicSpawned[strPathName] = list;
         }
     }
 }
Exemple #2
0
    public void DisposeTransform(Transform transform, bool forceDestroy)
    {
        IzPoolObject izPoolObject = transform.GetComponent <PoolObject>();       //TODO Denes 这里可以尝试优化
        IzSpawnPool  izSpawnPool  = null;

        if (izPoolObject != null && this._dicSpawnPool.TryGetValue(izPoolObject.GetPoolName(), out izSpawnPool) && izSpawnPool != null)
        {
            izSpawnPool.DisposeTransform(transform, forceDestroy);
        }
        else
        {
            UnityEngine.Object.Destroy(transform.gameObject);//不在池里的对象,直接destroy
        }
    }
Exemple #3
0
 private void AddToSpawnedDic(IzPoolObject izPoolObject)
 {
     if (izPoolObject != null && this._strPoolName == izPoolObject.GetPoolName())
     {
         string           strPathName = izPoolObject.GetPathName();
         List <Transform> list        = null;
         if (!this._dicSpawned.TryGetValue(strPathName, out list) || list == null)
         {
             list = new List <Transform>();
         }
         list.Add(izPoolObject.GetTransform());
         this._dicSpawned[strPathName] = list;
     }
 }