public void StartBattle(List <Enemy> _enemies) { //canMove = false; GameManager.instance.FadeToBattle(); HUDManager.instance.battle.SetActive(true); HUDManager.instance.mapa.SetActive(false); for (int i = 0; i < _enemies.Count + maxEnemies; i++) { if (i < maxEnemies) { int index = PartyManager.instance.partyList.FindIndex(d => d == battleAgents [i].name); if (battleAgents [i].gameObject.activeSelf) { HeroAgent heroAgent = battleAgents [i].GetComponent <HeroAgent> (); heroAgent.actualInfo.hp = PartyManager.instance.hpPoints [i]; heroParty.Add(heroAgent); if (index >= 0) { heroAgent.position = index; battleAgents [i].transform.localPosition = new Vector2(heroPositions [index], yPos); } } } else { battleAgents [i].gameObject.SetActive(true); EnemyAgent enemyAgent = battleAgents [i].GetComponent <EnemyAgent> (); enemyAgent.enemyInfo = _enemies [i - maxEnemies]; enemyAgent.position = i - maxEnemies; enemyAgent.DefineStats(); enemyParty.Add(enemyAgent); battleAgents [i].soundpack = enemyAgent.enemyInfo.soundpack; battleAgents [i].anim.runtimeAnimatorController = enemyAgent.enemyInfo.animator; battleAgents [i].transform.localPosition = new Vector2(enemyPositions [i - maxEnemies], yPos); } } turn = 0; EnqueueAgents(); NextTurn(); }