コード例 #1
0
    /// <summary>
    /// Update the current points in the game.
    /// </summary>
    /// <param name="lines">Number of lines that are cleared</param>
    /// <param name="isTSpin">True, if the player performed T-Spin</param>
    public void UpdateScore(int lines, bool isTSpin)
    {
        // Add score for T-Spin
        if (isTSpin == true)
        {
            _scoreContrl.AddTSpinScore();
        }

        // Add score for line clear
        switch (lines)
        {
        case 1:
            _scoreContrl.AddLineClearScore("OneLine");
            break;

        case 2:
            _scoreContrl.AddLineClearScore("TwoLines");
            break;

        case 3:
            _scoreContrl.AddLineClearScore("ThreeLines");
            break;

        case 4:
            _scoreContrl.AddLineClearScore("FourLines");
            break;

        default:
            break;
        }

        // Check if the points reach the level up threshold
        // If true, upgrade level
        if (_scoreContrl.points >= _nextLevelThreshold)
        {
            LevelUp();
        }

        pointsText.text = _scoreContrl.points.ToString();
    }