コード例 #1
0
    void placePentomino()
    {
        int[,] currentPentominoShape = currentPentomino.shape;
        int[,] parsedShape           = new int[5, 2];

        for (int i = 0; i < currentPentominoShape.GetLength(0); i++)
        {
            int tmpX = xPos + currentPentominoShape [i, 0];
            int tmpY = yPos + currentPentominoShape [i, 1];

            if (inverted == 3)
            {
                tmpX = xPos + (currentPentominoShape [i, 1] * -1);
                tmpY = yPos + currentPentominoShape [i, 0];
            }
            if (inverted == 2)
            {
                tmpX = xPos + (currentPentominoShape [i, 0] * -1);
                tmpY = yPos + (currentPentominoShape [i, 1] * -1);
            }
            if (inverted == 1)
            {
                tmpX = xPos + currentPentominoShape [i, 1];
                tmpY = yPos + (currentPentominoShape [i, 0] * -1);
            }
            parsedShape [i, 0] = tmpX;
            parsedShape [i, 1] = tmpY;
            gridTile tmpTile = GameController.getTileAt(tmpX, tmpY);
            tmpTile.empty        = false;
            tmpTile.currentValue = currentPentomino.values [i];
            GameObject           tmpGO         = GameController.getTileGO(tmpTile);
            tileObjectController tmpController = tmpGO.GetComponent <tileObjectController> ();
            tmpController.PlacePentomino();
            tmpController.updateTextColour();
            //updateTotals (tmpX, tmpY, currentPentomino.values [i]);
            totalsTile tmpTotal = GameController.getTotalTile(tmpX, 0);
            tmpTotal.checkForMatch();
            tmpTotal = GameController.getTotalTile(tmpY, 2);
            tmpTotal.checkForMatch();
        }
        //checkMatch (parsedShape);
        updateTotals();
        while (checkMatch())
        {
            updateTotals();
        }

        GameController.getNewPentomino();
    }