private void Turn(bool isClockwise) { if (Paused) { return; } if (_fallManager.Falling) { return; } if (_movementLock > 0) { return; } if (_selectedTouchPoint == null) { return; } var cells = _selectedTouchPoint.GetCells(); var turnCount = 0; while (turnCount < cells.Length) { var hexagons = new List <Hexagon>(); foreach (var cell in cells) { hexagons.Add(cell.Hexagon); } for (var i = 0; i < hexagons.Count; i++) { var next = isClockwise ? (i + 1) % hexagons.Count : (i + hexagons.Count - 1) % hexagons.Count; var current = hexagons[next]; current.AddToTurnDestination(cells[i]); cells[i].Hexagon = current; } var stopTurning = false; foreach (var cell in cells) { var touchPointsContainingCell = _touchPointsByCellId[cell.Id]; if (touchPointsContainingCell.Exists(touchPoint => touchPoint.CellsHaveSameColoredHexagons())) { stopTurning = true; break; } } if (stopTurning) { break; } turnCount++; } foreach (var cell in cells) { cell.Hexagon.ExecuteTurns(); } if (turnCount == cells.Length) { return; } _turnShouldEnd = true; Changed = true; }