public static TitleOrb Create(Vector3 spawnPos, bool fallDir, ORB_VALUE val) { TitleOrb orb = (Instantiate(Resources.Load <GameObject>(PREFAB_PATH), Vector3.zero, Quaternion.identity, TitleOrbPool.Instance.transform)).GetComponent <TitleOrb>(); orb.setInitValues(spawnPos, fallDir, val); return(orb); }
public GameObject GetPooledOrb(Vector3 spawnPos, bool fallDir, ORB_VALUE val) { foreach (GameObject o in pooledOrbs) { if (!o.activeInHierarchy) { TitleOrb orb = isTitleOrb(o); o.SetActive(true); o.transform.SetAsLastSibling(); orb.setInitValues(spawnPos, fallDir, val); return(o); } } GameObject obj = TitleOrb.Create(spawnPos, fallDir, val).gameObject; pooledOrbs.Add(obj); obj.transform.SetAsLastSibling(); return(obj); }