/// <summary> /// Destroys items in a cross shape. /// </summary> /// <returns>Points of destroyed items.</returns> /// <param name="refBoard">Reference to the game board.</param> /// <param name="centerX">X-coord of the shape centre.</param> /// <param name="centerY">Y-coord of the shape centre.</param> public ArrayList DestroyItemsInCrossShape(BoardItem[,] refBoard, int centerX, int centerY) { ArrayList destroyed = new ArrayList(); // X-line. for (int x = centerX - itemCountX; x <= centerX + itemCountX; x++) { if (x >= 0 && x < refBoard.GetLength(0)) { if (!refBoard[x, centerY].destroyed) { refBoard[x, centerY].destroyed = true; destroyed.Add(new Point(x, centerY)); } } } // Y-line. for (int y = centerY - itemCountY; y <= centerY + itemCountY; y++) { if (y >= 0 && y < refBoard.GetLength(1)) { if (!refBoard[centerX, y].destroyed) { refBoard[centerX, y].destroyed = true; destroyed.Add(new Point(centerX, y)); } } } return destroyed; }