IEnumerator PlayerMagicAttack() { bool isDead = enemyUnit.TakeDamage(playerUnit.Magicdamage); enemyHUD.SetHP(enemyUnit.currentHP); dialogueText.text = "You Attack with a Fireball!"; playerUnit.Magic(6); playerHUD.SetMana(playerUnit.currentMana); yield return(new WaitForSeconds(2f)); if (isDead) { state = BattleState.WON; EndBattle(); } else { state = BattleState.ENEMYTURN; StartCoroutine(EnemyTurn()); } }
IEnumerator PlayerHeal() { Instantiate(healFx, playerUnit.transform); playerUnit.Heal(15); playerHUD.SetHP(playerUnit.currentHp); dialogueText.text = "You feel renewed"; playerHUD.SetMana(playerUnit.currentMana); yield return(new WaitForSeconds(2f)); state = BattleState.ENEMYTURN; StartCoroutine(EnemyTurn()); }