/// <summary> /// Release all currently spawned objects based on given type. /// </summary> public void ReleaseAllByType(string type) { FactoryData factory; if (mFactory.TryGetValue(type, out factory)) { for (int i = 0; i < factory.actives.Count; i++) { PoolDataController pdc = factory.actives[i]; if (despawnCallback != null) { despawnCallback(pdc); } pdc.Despawn(); factory.ReleaseIgnoreActiveList(pdc); } factory.actives.Clear(); } else { Debug.LogWarning("Unable to find type: " + type); } }
public void Release(PoolDataController pdc) { if (pdc.claimed) //already claimed { return; } FactoryData dat; if (mFactory.TryGetValue(pdc.factoryKey, out dat)) { if (despawnCallback != null) { despawnCallback(pdc); } pdc.Despawn(); dat.Release(pdc); } else { Debug.LogWarning("Unable to find type: " + pdc.factoryKey + " in " + group + ", failed to release."); } }
public void Release(PoolDataController pdc) { pdc.Despawn(); FactoryData dat; if (mFactory.TryGetValue(pdc.factoryKey, out dat)) { dat.Release(pdc); } else { Debug.LogWarning("Unable to find type: " + pdc.factoryKey + " in " + group + ", failed to release."); } }
/// <summary> /// Releases all currently spawned objects of all types. /// </summary> public void ReleaseAll() { foreach (KeyValuePair <string, FactoryData> itm in mFactory) { FactoryData factory = itm.Value; for (int i = 0; i < factory.actives.Count; i++) { PoolDataController pdc = factory.actives[i]; pdc.Despawn(); factory.Release(pdc, false); } factory.actives.Clear(); } }
/// <summary> /// Release all currently spawned objects based on given type. /// </summary> public void ReleaseAllByType(string type) { FactoryData factory; if (mFactory.TryGetValue(type, out factory)) { for (int i = 0; i < factory.actives.Count; i++) { PoolDataController pdc = factory.actives[i]; pdc.Despawn(); factory.Release(pdc, false); } factory.actives.Clear(); } else { Debug.LogWarning("Unable to find type: " + type); } }
/// <summary> /// Releases all currently spawned objects of all types. /// </summary> public void ReleaseAll() { foreach (KeyValuePair <string, FactoryData> itm in mFactory) { FactoryData factory = itm.Value; for (int i = 0; i < factory.actives.Count; i++) { PoolDataController pdc = factory.actives[i]; if (despawnCallback != null) { despawnCallback(pdc); } pdc.Despawn(); factory.ReleaseIgnoreActiveList(pdc); } factory.actives.Clear(); } }