public void DestroyPool() { while (mPool.Count > 0) { PooledObjectInstance obj = mPool.Dequeue(); obj.DestroyInstance(); } mPool.Clear(); }
public void ResetPool(ResetCriteria resetCriteria) { for (int i = 0; i < mPool.Count; i++) { PooledObjectInstance inst = mPool.DequeueAndEnqueueToBack(); if (resetCriteria(inst.Instance)) { inst.Instance.SetActive(false); } } }
private GameObject Spawn(System.Action <PooledObjectInstance> spawnAction, EFetchType type) { PooledObjectInstance obj = Fetch(type); if (obj == null) { return(null); } spawnAction(obj); return(obj.Instance); }
private PooledObjectInstance FetchOnlyInActive() { for (int i = 0; i < mPool.Count; i++) { PooledObjectInstance value = mPool.DequeueAndEnqueueToBack(); if (!value.Instance.activeSelf) { return(value); } } return(null); }
private static void ValidateInstance <T>(PooledObjectInstance obj, T msg) { Assert.IsNotNull(obj, "GamePool does not contain: " + msg); }