private List <GameboardCell> GetNeighborCells(CellPlace cell) { List <GameboardCell> ret = new List <GameboardCell>(6); for (int i = 0; i < 6 /*deltas.GetLength(0)*/; ++i) { GameboardCell cur_cell = GetNearCell(cell, i); if (cur_cell != null) { ret.Add(cur_cell); } } return(ret); }
public GameboardCell GetNearCell(CellPlace place, int idx) { int[,] deltas = (place.board_x % 2) == 0 ? neighbor_cells_deltas1 : neighbor_cells_deltas2; int x = place.board_x + deltas [idx, 0]; int y = place.board_y + deltas [idx, 1]; if (x >= 0 && x < cells.GetLength(0) && y >= 0 && y < cells.GetLength(1) && cells[x, y].active) { return(cells[x, y]); } return(null); }