示例#1
0
    void ScoreFromLines(int clearedLines)
    {
        int scoreToAdd = 0;

        switch (clearedLines)
        {
        case 1:
            scoreToAdd += (100 * values.level);
            AudioManager.instance.Play("Single");
            bTBTetris = false;
            GameManager.hUD.AddToScore(scoreToAdd);
            break;

        case 2:
            scoreToAdd += (300 * values.level);
            AudioManager.instance.Play("Double");
            bTBTetris = false;
            GameManager.hUD.AddToScore(scoreToAdd);
            break;

        case 3:
            scoreToAdd += (500 * values.level);
            AudioManager.instance.Play("Triple");
            bTBTetris = false;
            GameManager.hUD.AddToScore(scoreToAdd);
            break;

        case 4:
            if (!bTBTetris)
            {
                scoreToAdd += (800 * values.level);
                bTBTetris   = true;
            }
            else
            {
                scoreToAdd += (800 * 3 / 2 * values.level);
            }
            AudioManager.instance.Play("Tetris");
            GameManager.hUD.AddToScore(scoreToAdd);
            break;
        }

        hUD.AddToScore(scoreToAdd);

        // Increase levels on Marathon
        if (GameSettings.gameTypeName == "Marathon")
        {
            for (int i = 0; i < clearedLines; i++)
            {
                lvlLinesCleared++;
                if (lvlLinesCleared == 20)
                {
                    lvlLinesCleared = 0;
                    values.level++;
                    UpdateGameLevel();
                }
            }
        }
        values.linesCleared += clearedLines;
        hUD.UpdateLinesCleared();
    }