Inheritance: UnityEngine.MonoBehaviour
Esempio n. 1
0
        internal void SelfDestruct()
        {
            mPrefab   = null;
            mPrefabGO = null;

            if (mSpawnPool != null)
            {
                Transform tmp = null;
                for (int i = 0; i < mDespawned.Count; ++i)
                {
                    tmp = mDespawned[i];
                    if (tmp == null)
                    {
                        continue;
                    }
                    mSpawnPool.DestroyInstance(tmp.gameObject);
                }

                for (int i = 0; i < mSpawned.Count; ++i)
                {
                    tmp = mSpawned[i];
                    if (tmp == null)
                    {
                        continue;
                    }
                    mSpawnPool.DestroyInstance(tmp.gameObject);
                }
            }

            mSpawned.Clear();
            mDespawned.Clear();

            mSpawnPool = null;
        }
Esempio n. 2
0
 internal bool RemoveSpawnPool(SpawnPool spawnPool)
 {
     if (!mPools.ContainsKey(spawnPool.PoolName) && Application.isPlaying)
     {
         Debug.LogError(string.Format("PoolManager: Unable to remove '{0}'. " +
                                      "Pool not in PoolManager",
                                      spawnPool.PoolName));
         return(false);
     }
     mPools.Remove(spawnPool.PoolName);
     return(true);
 }
Esempio n. 3
0
        internal void AddSpawnPool(SpawnPool spawnPool)
        {
            if (mPools.ContainsKey(spawnPool.PoolName))
            {
                return;
            }

            mPools.Add(spawnPool.PoolName, spawnPool);
            if (mOnCreatedDelegates.ContainsKey(spawnPool.PoolName))
            {
                mOnCreatedDelegates[spawnPool.PoolName](spawnPool);
            }
        }
Esempio n. 4
0
 internal bool RemoveSpawnPool(SpawnPool spawnPool)
 {
     if (!mPools.ContainsKey(spawnPool.PoolName) && Application.isPlaying)
     {
         Debug.LogError(string.Format("PoolManager: Unable to remove '{0}'. " +
                                         "Pool not in PoolManager",
                                     spawnPool.PoolName));
         return false;
     }
     mPools.Remove(spawnPool.PoolName);
     return true;
 }
Esempio n. 5
0
        internal void AddSpawnPool(SpawnPool spawnPool)
        {
            if (mPools.ContainsKey(spawnPool.PoolName))
            {
                return;
            }

            mPools.Add(spawnPool.PoolName, spawnPool);
            if (mOnCreatedDelegates.ContainsKey(spawnPool.PoolName))
            {
                mOnCreatedDelegates[spawnPool.PoolName](spawnPool);
            }
        }
Esempio n. 6
0
        internal void SelfDestruct()
        {
            mPrefab = null;
            mPrefabGO = null;

            if (mSpawnPool != null)
            {
                Transform tmp = null;
                for (int i = 0; i < mDespawned.Count; ++i)
                {
                    tmp = mDespawned[i];
                    if (tmp == null) continue;
                    mSpawnPool.DestroyInstance(tmp.gameObject);
                }

                for (int i = 0; i < mSpawned.Count; ++i)
                {
                    tmp = mSpawned[i];
                    if (tmp == null) continue;
                    mSpawnPool.DestroyInstance(tmp.gameObject);
                }
            }

            mSpawned.Clear();
            mDespawned.Clear();

            mSpawnPool = null;
        }