Unity 2.5D Turn-Based RPG Course. Player Attacking Random Enemies

The basis of my combat is ready, but when choosing which enemy to attack this happens randomly, I created an enemy with a different name to try but it doesn’t solve it. I leave the code for “Select Enemy” here. Thank you very much.

public void SelectEnemy(int currentEnemy)
{

  BattleEntities currentPlayerEntity = playerBattlers[currentPlayer];
  currentPlayerEntity.SetTarget(allBattlers.IndexOf(enemyBattlers[currentEnemy]));

 
  currentPlayerEntity.BattleAction = BattleEntities.Action.Attack;

  
  currentPlayer++;

  if(currentPlayer >= playerBattlers.Count)
  {
      StartCoroutine(BattleRoutine());
  }
  else
  {
    enemySelectionMenu.SetActive(false);
    ShowBattleMenu();
  }


}

Privacy & Terms