void AddFormation(List <int> defensorRounds, List <int> attackerRounds) { ClearCharacters(); AttackterTotalMaxHP = 0; DefensorTotalMaxHP = 0; foreach (var unit in units) { if (defensorRounds.Contains(unit.Data.Round)) { DTCharacter data = new DTCharacter(GameConfig.DefensorBaseHP, EnCharacterType.Defensor); var character = Instantiate(prefabDefensor, unit.transform); character.gameObject.SetActive(true); character.SetData(GetSpawnId(), data); character.transform.localPosition = new Vector3(0, -character.Size.y * character.SpineScale, 0); defensors.Add(character); unit.UpdateCharacter(character); character.UpdateStandingBase(unit); character.OnCharacterDie = OnCharacterDie; miniMap.AddCharacter(character); DefensorTotalMaxHP += character.Data.BaseHP; } else if (attackerRounds.Contains(unit.Data.Round)) { DTCharacter data = new DTCharacter(GameConfig.AttackerBaseHP, EnCharacterType.Attacker); var character = Instantiate(prefabAttacker, unit.transform); character.gameObject.SetActive(true); character.SetData(GetSpawnId(), data); character.transform.localPosition = new Vector3(0, -character.Size.y * character.SpineScale, 0); attackers.Add(character); unit.UpdateCharacter(character); character.UpdateStandingBase(unit); character.OnCharacterDie = OnCharacterDie; miniMap.AddCharacter(character); AttackterTotalMaxHP += character.Data.BaseHP; } } DefensorTotalHP = DefensorTotalMaxHP; AttackterTotalHP = AttackterTotalMaxHP; IsReady = true; miniMap.gameObject.SetActive(true); }