예제 #1
0
 public void ClearAll()
 {
     for (int i = 0; i < AllTiles.Count; i++)
     {
         MonoBehaviourPooledObject tile = AllTiles[i].GetComponent <MonoBehaviourPooledObject>();
         tile.WithdrawToPool();
     }
     AllTiles.Clear();
     RoofTiles.Clear();
 }
예제 #2
0
 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;
 }
예제 #3
0
    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);
    }