IEnumerator PlayerAttack() { playerAttackState = PlayerAttackInProgress.YES; // update state; the player is currently in an attack dialogueText.text = "Rockett shoves Nicole!"; yield return(new WaitForSeconds(1f)); bool isDead = enemyUnit.TakeDamage(playerUnit.damage); enemyHUD.SetHP(enemyUnit.currentHP); flowchart.ExecuteBlock("PunchEnemy"); yield return(new WaitForSeconds(1f)); dialogueText.text = "Nicole staggers backwards!"; yield return(new WaitForSeconds(2f)); Debug.Log(state); if (isDead) { state = BattleState.WON; EndBattle(); } else { playerAttackState = PlayerAttackInProgress.NO; // the player's attack is finished state = BattleState.ENEMYTURN; StartCoroutine(EnemyTurn()); } }
public PlayerHealInProgress playerHealState; // "" healing // Start is called before the first frame update void Start() { state = BattleState.START; playerAttackState = PlayerAttackInProgress.NO; // at the start of the game, the player is not attacking playerHealState = PlayerHealInProgress.NO; // "" healing // Debug.Log(state); StartCoroutine(SetupBattle()); }