IEnumerator enemyturn() { battletext.text = enemy.UnitName + "turn"; button.SetActive(false); yield return(new WaitForSeconds(1f)); bool isdead = player.takedamage(enemy.damage); playerhud.setHP(player.currrentHP); yield return(new WaitForSeconds(1f)); if (isdead) { state = Battle.LOST; endbattle(); } else { state = Battle.PLAYERTURN; playerturn(); } }
IEnumerator playerattack() { bool isdead = enemy.takedamage(player.damage); enemyhud.setHP(enemy.currrentHP); yield return(new WaitForSeconds(2f)); if (isdead) { state = Battle.WON; endbattle(); } else { state = Battle.ENEMYTURN; StartCoroutine(enemyturn()); } }