public FallingState(ArchiTetris e) { e.movingFromWait = false; e.resetBoard(); List <KeyValuePair <int, int> > poses = e.currentBlock.getPos(); WrapperBlock wBlock = (WrapperBlock)e.currentBlock; foreach (KeyValuePair <int, int> p in poses) { e.boardTiles[p.Key, p.Value].BackColor = wBlock.c; } }
public DoneState(ArchiTetris e) { // place current block on numArray List <KeyValuePair <int, int> > poses = e.currentBlock.getPos(); WrapperBlock wBlock = (WrapperBlock)e.currentBlock; foreach (KeyValuePair <int, int> p in poses) { e.boardArray[p.Key, p.Value] = e.getColorNum(wBlock.c); } // check for clearing lines for (int j = 19; j > 0; j--) { bool wholeRow = true; for (int i = 0; i < 10; i++) { if (e.boardArray[i, j] == 0) { wholeRow = false; } } if (wholeRow) { for (int k = j; k > 1; k--) { for (int i = 0; i < 10; i++) { e.boardArray[i, k] = e.boardArray[i, k - 1]; } } for (int i = 0; i < 10; i++) { e.boardArray[i, 0] = 0; } } } e.resetBoard(); nextState(e); }
public BlockIF getColoredBlock(string str) { WrapperBlock wBlock = new WrapperBlock(getBlock(str), getColor()); return((BlockIF)wBlock); }