Пример #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);
    }