public void ClearAll() { for (int i = 0; i < AllTiles.Count; i++) { MonoBehaviourPooledObject tile = AllTiles[i].GetComponent <MonoBehaviourPooledObject>(); tile.WithdrawToPool(); } AllTiles.Clear(); RoofTiles.Clear(); }
GameObject CreateObject(Pool pool){ GameObject obj = Instantiate(pool.prefab, gameObject.transform); obj.SetActive(false); MonoBehaviourPooledObject PooledObjectScript = obj.GetComponent<MonoBehaviourPooledObject>(); if(PooledObjectScript != null) PooledObjectScript.SetQueue(poolDictionary[pool.tag]); else { Destroy(obj); return null; } PooledObjectScript.WithdrawToPool(); return obj; }
GameObject CreateObjectSinlge() { GameObject obj = Instantiate(pool.prefab, gameObject.transform); obj.SetActive(false); MonoBehaviourPooledObject PooledObjectScript = obj.GetComponent <MonoBehaviourPooledObject>(); if (PooledObjectScript != null) { PooledObjectScript.SetQueue(poolQueue); } else { Destroy(obj); return(null); } PooledObjectScript.WithdrawToPool(); return(obj); }