public void Pooling(GameObject prefab, string type, int amount = 10) { if (!SkillObj.ContainsKey(type)) { List <GameObject> list = new List <GameObject>(); SkillObj.Add(type, list); } List <GameObject> tempList = new List <GameObject>(); for (int i = 0; i < amount; ++i) { GameObject obj = Instantiate(prefab, mySkills.transform); obj.SetActive(false); tempList.Add(obj); switch (type) { case "Q": obj.GetComponent <AlistarQ>().mySkill = this; break; case "E": obj.GetComponent <AlistarE>().mySkill = this; break; } } SkillObj[type].InsertRange(0, tempList); }
public void Pooling(GameObject prefab, string type, int amount = 10) { if (!SkillObj.ContainsKey(type)) { List <GameObject> list = new List <GameObject>(); SkillObj.Add(type, list); } List <GameObject> tempList = new List <GameObject>(); for (int i = 0; i < amount; ++i) { GameObject obj = Instantiate(prefab, mySkills.transform); obj.GetComponent <SkillFactioner>().ChampFogEntity = TheChampionBehaviour.GetComponent <FogOfWarEntity>(); if (team == "") { team = GetComponent <PhotonView>().owner.GetTeam().ToString(); } if (team.Equals("red")) { obj.GetComponent <FogOfWarEntity>().faction = FogOfWar.Players.Player00; } else if (team.Equals("blue")) { obj.GetComponent <FogOfWarEntity>().faction = FogOfWar.Players.Player01; } obj.SetActive(false); tempList.Add(obj); switch (type) { case "Q": obj.GetComponent <AlistarQ>().mySkill = this; break; case "E": obj.GetComponent <AlistarE>().mySkill = this; break; } } SkillObj[type].InsertRange(0, tempList); }