public void VecinoClickeado(ButtonsGrid buttonsGrid) { if (this.number == 0 && !clicked) { clicked = true; var neighbors = buttonsGrid.GetNeighbors(this.pos[0], this.pos[1]); foreach (Model_button neighbor in neighbors) { neighbor.VecinoClickeado(buttonsGrid); } } else { SetClick(); } }
public void setNumber(ButtonsGrid buttonsGrid) { if (number == -1) { return; } int n = 0; var neighbors = buttonsGrid.GetNeighbors(this.pos[0], this.pos[1]); foreach (Model_button neighbor in neighbors) { if (neighbor.isBomb()) { n += 1; } } this.number = n; }
public bool Click(bool isLeftClick, ButtonsGrid buttonsGrid) { if (isLeftClick) { if (isBomb()) { return(true); } else { if (flag == 1) { return(false); } if (!clicked) { clicked = true; flag = 0; if (number == 0) { var neighbors = buttonsGrid.GetNeighbors(this.pos[0], this.pos[1]); foreach (Model_button neighbor in neighbors) { neighbor.VecinoClickeado(buttonsGrid); } } } } } else { if (!isClicked()) { flag = flag == 2 ? 0 : flag + 1; } } return(false); }
public Model(int filas, int columnas, int bombas) { buttonsGrid = new ButtonsGrid(filas, columnas, bombas); }