Example #1
0
    void GameMode_Playing()
    {
        // TODO:
        //	Consider - swap current tile for previewed.
        //				Can always do it?
        //				Have to earn by getting Tetris(es)?
        //				Where does piece swap to - current location, or top?  (current, seems most fair)

        while (CurrentFallingPiece == null)
        {
            CreateNextPiece();
        }

        Drop dropScript = CurrentFallingPiece.GetComponent <Drop>();

        if (dropScript.AtBottom)
        {
            bool tilesInBuffer = dropScript.DecomposePiece();

            DestroyPiece(CurrentFallingPiece);
            CurrentFallingPiece = null;

            if (tilesInBuffer)
            {
                ChangeMode(Mode.GameOver);
            }
            else
            {
                ClearCompleteLines();
            }

            PieceSwapped = false;                       // Allow further piece swaps.
        }
    }