官术网_书友最值得收藏!

Time for action – generating fading pieces

  1. In the Game1 class, modify the CheckScoringChain() method by adding the following call inside the foreach loop before the square is set to "Empty":
    gameBoard.AddFadingPiece(
        (int)ScoringSquare.X,
        (int)ScoringSquare.Y,
        gameBoard.GetSquare(
          (int)ScoringSquare.X,
          (int)ScoringSquare.Y));

What just happened?

Adding fading pieces is simply a matter of getting the square (before it is replaced with an empty square) and adding it to the FadingPieces dictionary. We need to use the (int) typecasts because the ScoringSquare variable is a Vector2 value, which stores its X and Y components as floats.

Falling pieces

Falling pieces are added to the game board in two possible locations: From the FillFromAbove() method when a piece is being moved from one location on the board to another, and in the GenerateNewPieces() method, when a new piece falls in from the top of the game board.

主站蜘蛛池模板: 南汇区| 庐江县| 孟州市| 右玉县| 册亨县| 吉林省| 隆尧县| 美姑县| 常德市| 新安县| 乌拉特中旗| 抚顺市| 甘南县| 琼结县| 内乡县| 和龙市| 格尔木市| 阳山县| 安吉县| 化隆| 荣昌县| 建阳市| 师宗县| 许昌市| 专栏| 资兴市| 普洱| 禹州市| 贵州省| 武陟县| 双流县| 沛县| 宁晋县| 星子县| 蒲江县| 无锡市| 钟祥市| 甘洛县| 吉隆县| 阿坝| 五大连池市|