Beispiel #1
0
    private IEnumerator PerformEnemyMove()
    {
        battleState = BattleState.EnemyMove;

        //var move = enemy.enemyUnit.Pokemon.GetRandomMove();
        var move = enemy.EnemyAtk(playerUnit.Pokemon);

        yield return(dialogBox.TypeDialog($"The opposing {enemy.enemyUnit.Pokemon.Base.Name} used {move.Base.Name}!"));

        enemy.enemyUnit.AttackAnimation();
        yield return(new WaitForSeconds(1.0f));

        playerUnit.HitAnimation();

        var dmgInfo = playerUnit.Pokemon.TakeDamage(move, enemy.enemyUnit.Pokemon);

        yield return(playerHud.UpdateHp());

        yield return(ShowDamageInfo(dmgInfo));

        if (dmgInfo.Faint)
        {
            yield return(dialogBox.TypeDialog($"{playerUnit.Pokemon.Base.Name} fainted."));

            playerUnit.FaintAnimation();
        }
        else
        {
            PlayerAction();
        }
    }