IEnumerator PerformPlayerMove() { State = BattleState.Busy; var move = playerUnit.unit.moves[currentMove]; yield return(dialogBox.TypeDialog($"{playerUnit.unit.Base.name} Used {move.Base.name}")); yield return(new WaitForSeconds(1f)); bool isFainted = EnemyUnit.unit.TakeDamage(move, playerUnit.unit); yield return(EnemyHud.UpdateHP()); if (isFainted) { yield return(dialogBox.TypeDialog($"{EnemyUnit.unit.Base.Name} Fainted")); } else { StartCoroutine(enemyMove()); } }
IEnumerator enemyMove() { State = BattleState.EnemyMove; var move = EnemyUnit.unit.GetrandomMove(); yield return(dialogBox.TypeDialog($"{EnemyUnit.unit.Base.name} Used {move.Base.name}")); yield return(new WaitForSeconds(1f)); bool isFainted = playerUnit.unit.TakeDamage(move, playerUnit.unit); yield return(PlayerHud.UpdateHP()); if (isFainted) { yield return(dialogBox.TypeDialog($"{playerUnit.unit.Base.Name} Fainted")); } else { PlayerAction(); } }