void PuzzlePiece.Dependency.HandleInput(PuzzlePiece inputPiece) { List <Vector2Int> neighborDirections = GetNeighborDirections(); foreach (var direction in neighborDirections) { Vector2Int neighborIndex = inputPiece.index + direction; PuzzlePiece targetPiece; if (currentPieceMap.TryGetValue(neighborIndex, out targetPiece) && targetPiece.isInvisiblePiece) { PuzzlePiece.SwapIndex(inputPiece, targetPiece); currentPieceMap[inputPiece.index] = inputPiece; currentPieceMap[targetPiece.index] = targetPiece; inputPiece.MoveRelative(direction); targetPiece.MoveRelative(direction * -1); break; } } if (CheckSolved()) { previewGui.enabled = false; unrevealTextGui.enabled = false; revealTextGui.enabled = true; } }