private void CreateCellPath(int xDirection, int yDirection, int movement) { var currentX = CurrentCell.boardPosition.x; var currentY = CurrentCell.boardPosition.y; for (var i = 1; i <= movement; i++) { currentX += xDirection; currentY += yDirection; var cellState = CurrentCell.board.ValidateCell(currentX, currentY, this); if (cellState == CellState.Enemy) { HighlightedCells.Add(CurrentCell.board.AllCells[currentX, currentY]); break; } if (cellState != CellState.Free) { break; } HighlightedCells.Add(CurrentCell.board.AllCells[currentX, currentY]); } }
private void ClearCells() { foreach (var cell in HighlightedCells) { cell.outlineImage.enabled = false; } HighlightedCells.Clear(); }