IEnumerator PlayerAttack() { //MakeSelection(); bool isDead = enemy1Unit.TakeDamage(player1Unit.data.damage); enemyHUD.SetHP(enemy1Unit.data.currentHP); Debug.Log("Attack successful against " + enemy1Unit); // Hide the player Actions options after selection is made playerHUD.DisableActions(playerHUD); yield return(new WaitForSeconds(2f)); if (isDead) { state = BattleState.WON; EndBattle(); } else { state = BattleState.ENEMYTURN; EnemyTurn(); } }
IEnumerator EnemyAttack() { bool isDead = playerUnit.TakeDamage(enemyUnit.damage); playerHUD.SetHP(playerUnit.currentHP); Debug.Log("Attack successful"); // Hide the enemy's Actions options after selection is made enemyHUD.DisableActions(enemyHUD); yield return(new WaitForSeconds(2f)); if (isDead) { state = BattleState.LOST; EndBattle(); } else { state = BattleState.PLAYERTURN; PlayerTurn(); } }