Esempio n. 1
0
    private void HandleEnemyTurnEnd(int enemyHandTotal)
    {
        Debug.Log($"Enemy's hand total: {enemyHandTotal}");

        var handDifference = playerHandTotal - enemyHandTotal;

        Debug.Log($"Hand difference {handDifference}");

        bool playerIsDead = false;
        bool enemyIsDead  = false;

        if (enemyHandTotal > 21)
        {
            enemyHealth.DealDamage(1);
        }
        else if (handDifference < 0)
        {
            playerIsDead = playerHealth.DealDamage(1 + enemy.AttackModifier) == 0;
        }
        else if (handDifference > 0)
        {
            enemyIsDead = enemyHealth.DealDamage(1 + player.AttackModifier) == 0;
        }

        if (!playerIsDead && !enemyIsDead)
        {
            StartNewRound();
        }
    }