void OnStartBattle() { for (int i = 0; i < BattlePvP.Instance.redTeamList.Count; i++) { BattleHero hero = BattlePvP.Instance.redTeamList[i]; PvPHeroSlot slot = CreateSlot(); slot.InitSlot((i + 1), hero); hero.onChangedCumulativeDamage += OnChangedCumulativeDamage; } int count = BattlePvP.Instance.redTeamList.Count; SizeControl(count); StartCoroutine(StartBattleCoroutine()); }
PvPHeroSlot CreateSlot() { PvPHeroSlot slot = null; for (int i = 0; i < heroSlotPool.Count; i++) { if (heroSlotPool[i].gameObject.activeSelf == false) { slot = heroSlotPool[i]; break; } } if (slot == null) { GameObject go = Instantiate(pvpHeroSlotPrefab, scrollViewContent.transform, false); slot = go.GetComponent <PvPHeroSlot>(); heroSlotPool.Add(slot); } return(slot); }