private void CheckMatchesInCell(int id, int lastId, ToolMoveType toolMoveType) { if (toolMoveType == ToolMoveType.secondExgenge) { return; } int width = Field.CurentFieldWidth; int height = Field.CurentFieldHeight; int toolType = Field.toolsOnField[id]; int matcheInRow = 0; int matcheInColumn = 0; int row = id / width; int column = id - row * height; int[] matchInRowID = new int[5] { -1, -1, -1, -1, -1 }; int[] matchInColumnID = new int[5] { -1, -1, -1, -1, -1 }; int index = 0; if (row != 0) { for (int i = 1; i <= row; i++) { if (Field.toolsOnField[id - i * width] == toolType) { matchInColumnID[index] = id - i * width; index++; matcheInColumn++; } else { break; } } } if (row != height - 1) { for (int i = 1; i < height - row; i++) { if (Field.toolsOnField[id + i * width] == toolType) { matchInColumnID[index] = id + i * width; index++; matcheInColumn++; } else { break; } } } index = 0; if (column != 0) { for (int i = 1; i <= column; i++) { if (Field.toolsOnField[id - i] == toolType) { matchInRowID[index] = id - i; index++; matcheInRow++; } else { break; } } } if (column != width - 1) { for (int i = 1; i < width - column; i++) { if (Field.toolsOnField[id + i] == toolType) { matchInRowID[index] = id + i; index++; matcheInRow++; } else { break; } } } if (matcheInRow < 2 && matcheInColumn < 2) { haveMatchOnField[id] = (int)Cell.isNotMatch; } else { if (InvisibleTipEvent != null) { InvisibleTipEvent(tipCellId); } if (PlayerMoveEvent != null) { PlayerMoveEvent(); } haveMatchOnField[id] = (int)Cell.isMatch; } StartCoroutine(CheckReturnExgangeCoroutine(id, lastId, matchInRowID, matcheInRow, matchInColumnID, matcheInColumn, toolMoveType)); }