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; }
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); }
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); } }
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; }
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; }