Ejemplo n.º 1
0
    /// <summary>
    /// Award points for clearing line, spins, combos, etc.
    /// </summary>
    private void AwaredScore(int lineClears, SpinReward spinBonus)
    {
        int score;

        if (spinBonus == SpinReward.Regular)
        {
            score = 400 + lineClears * 400;
        }
        else
        {
            switch (lineClears)
            {
            case 1:
                score = 100;
                break;

            case 2:
                score = 300;
                break;

            case 3:
                score = 500;
                break;

            case 4:
                score = 800;
                break;

            default:
                score = 0;
                break;
            }
            if (spinBonus == SpinReward.Mini)
            {
                score += 100;
            }
        }
        // Back to back gives + 50%
        if (spinBonus == SpinReward.Regular || lineClears == 4)
        {
            if (BackToBack)
            {
                score += score / 2;
            }
            BackToBack = true;
        }
        else
        {
            BackToBack = false;
        }
        // Combo points
        if (lineClears > 0)
        {
            score += Combo * 50;
            Combo++;
        }
        else
        {
            Combo = 0;
        }
        // Check for a perfect clear
        if (Board.IsEmpty())
        {
            switch (lineClears)
            {
            case 1:
                score += 800;
                break;

            case 2:
                score += 1000;
                break;

            case 3:
                score += 1800;
                break;

            case 4:
                score += 2000;
                break;
            }
        }
        this.Score += score;
        EmitSignal(nameof(ScoreUpdateSignal));
    }