// TODO: Make this faster private void RemoveRows() { bool fullRow; for (int y = Constants.PLAYFIELD_HEIGHT - 1; y >= 0; y--) { fullRow = true; for (int x = 0; x < Constants.PLAYFIELD_WIDTH; x++) { Nibbit temp = new Nibbit(Color.White, new Point(x, y), GraphicsDevice); if (!LockedNibbits.Contains(temp)) { fullRow = false; break; } } if (fullRow) { // Lambda expression bitches! Remove all Nibbets in row y! LockedNibbits.RemoveAll(n => n.CompareRow(y) == 0); RowsToDrop.Insert(0, y); } } }
public bool Contains(Nibbit n) { foreach (Nibbit myNib in NibSets[NibSetIndex]) { Nibbit offsetNib = new Nibbit(myNib); offsetNib.Offset(Position); if (offsetNib.Equals(n)) return true; } return false; }