Пример #1
0
    IEnumerator EnemyTurn()
    {
        Action.whosAttacking = 1;                                                      // for Action to know how to deal with will checks for abilities
        yield return(StartCoroutine(DisplayMessage(enemy.enemyName + " attacked! "))); //attack message

        (int, int, int)stats = enemyAI.EnemyAttack();                                  // saving stats like this can be used to make the dialogue more specific when the enemy attacks

        yield return(new WaitForSeconds(1f));

        bool isDead = PlayerStats.Instance.adjustWill(stats.Item2); //checks if player is dead post-damage

        enemy.adjustHealth(stats.Item3);                            //in case it's a self harming move

        enemyHUD.SetEnemyHUD(enemy);
        playerHUD.SetPlayerHUD();

        Action.whosAttacking = 0; //go back to player input for Action

        yield return(new WaitForSeconds(1f));

        //check whether the player won or lost
        if (isDead)
        {
            state = BattleState.LOST;
            EndBattle();
        }
        else
        {
            move  = 0;
            state = BattleState.PLAYERTURN;
            PlayerTurn();
        }
    }