public static GameObject Instantiate(string name, Vector3 position, Quaternion quat, Transform parent = null, GameObject prefab = null, bool pool = false, float max = Mathf.Infinity)
    {
        GameObject aux;

        if (!pool)
        {
            aux      = GameObject.Instantiate(prefab, position, quat, parent);
            aux.name = name;
        }
        else
        {
            aux = StaticPool.Instantiate(prefab, position, parent, max);
            aux.AddOnlyOneComponent <MultiTags>();
            aux.AddTags("pool");
        }
        return(aux);
    }
Exemplo n.º 2
0
 void Create()
 {
     StaticPool.Instantiate(obj, Vector3.down, gameObject.transform, 2);
     Invoke("Create", 1f);
 }
Exemplo n.º 3
0
 void Put()
 {
     StaticPool.Instantiate(obj, Vector3.down, gameObject.transform);
     Invoke("Put", time);
 }
Exemplo n.º 4
0
 void SpawnEnemy()
 {
     StaticPool.Instantiate(enemyPrefab, enemyPrefab.transform.position);
 }
Exemplo n.º 5
0
 void Create()
 {
     StaticPool.Instantiate(obj, Vector3.down, gameObject.transform, numberMax);
     Invoke("Put", time);
 }