Example #1
0
	public void DropPieces(CellLogic cell)
	{
		int c = cell.GetCol();
		int or = 1;
		// check how position is must drop before lay onto any piece
		while(cell.dn != null &&cell.dn.Match(CellColor.NoColor))
		{
			cell = cell.dn;
		  	or++;
		}

		// drop the cells 
		for(int r = cell.GetRow()-or; r >= 0; r--)
		{ 
			if(cells[r+or][c].Match(CellColor.NoColor))
			{
				cells[r+or][c].SetColor(cells[r][c].GetColor());
				cells[r][c].SetColor(CellColor.NoColor);
			}
		}

		// clear the top cells
		for(int r = or; r >= 0; r--)
		{
			cells[r][c].SetColor(CellColor.NoColor);
		}
	}