public void InitPool(Dictionary <int, XmlFigure> dic) { int length = dic.Count; figuresPrefab = new Figure[length]; pool = new List <Figure> [length]; for (int i = 0; i < length; i++) { string path = PREFAB_FOLDER + dic[i].prefab; GameObject go = Resources.Load(path) as GameObject; figuresPrefab[i] = go.GetComponent <Figure>(); List <Figure> fList = new List <Figure>(); for (int j = 0; j < ITEMS_FOR_SPAWN; j++) { Figure temp = Instantiate(figuresPrefab[i], transform.position, Quaternion.identity, transform); temp.InitComponent(i); temp.gameObject.SetActive(false); fList.Add(temp); } pool[i] = fList; } for (int i = 0; i < ITEMS_FOR_SPAWN; i++) { ParticleController temp = Instantiate(particleObj, transform.position, Quaternion.identity, transform); temp.InitParticles(); temp.gameObject.SetActive(false); particles.Add(temp); } }
private void SpawnAdditionalParticles() { for (int i = 0; i < ADDITIONAL_ITEMS; i++) { ParticleController temp = Instantiate(particleObj, transform.position, Quaternion.identity, transform); temp.InitParticles(); temp.gameObject.SetActive(false); particles.Add(temp); } }