public static int[] TryCollectFullRows(this IGridManager gridManager)
        {
            var grid       = gridManager.Grid;
            var dimensions = grid.Dimensions;

            var fullRows = gridManager.GetFullRows().ToArray();

            foreach (var row in fullRows)
            {
                for (var x = 0; x < dimensions.x; x++)
                {
                    Object.Destroy(gridManager.GetBlock(new Vector2Int(x, row)));
                    for (var y = row; y >= 1; y--)
                    {
                        var currentRowCoordinate  = new Vector2Int(x, y);
                        var previousRowCoordinate = new Vector2Int(x, y - 1);

                        var currentBlock = gridManager.GetBlock(previousRowCoordinate);
                        gridManager.SetBlock(currentRowCoordinate, currentBlock);

                        if (currentBlock != null)
                        {
                            currentBlock.transform.position = grid.GetWorldCoordinate(currentRowCoordinate);
                        }

                        gridManager.SetBlock(previousRowCoordinate, null);
                    }
                }
            }
            return(fullRows);
        }
        public static IEnumerable <int> GetFullRows(this IGridManager gridManager)
        {
            var grid       = gridManager.Grid;
            var dimensions = grid.Dimensions;

            for (var y = 0; y < dimensions.y; y++)
            {
                var isFullRow = true;
                for (var x = 0; x < dimensions.x; x++)
                {
                    if (gridManager.GetBlock(new Vector2Int(x, y)) == null)
                    {
                        isFullRow = false;
                        break;
                    }
                }

                if (isFullRow)
                {
                    yield return(y);
                }
            }
        }
        private static bool CheckCollision(
            this IGridManager gridManager,
            Vector2Int coordinate,
            Shape shape,
            Vector2Int step)
        {
            var sizeX = shape.Size.x;
            var sizeY = shape.Size.y;

            var dimensions = gridManager.Grid.Dimensions;
            var maxX       = dimensions.x - 1;
            var maxY       = dimensions.y - 1;

            for (var x = 0; x < sizeX; x++)
            {
                for (var y = 0; y < sizeY; y++)
                {
                    if (!shape.GetBlock(new Vector2Int(x, y)))
                    {
                        continue;
                    }

                    var resultX = coordinate.x + x + shape.Offset.x + step.x;
                    var resultY = coordinate.y + y + shape.Offset.y + step.y;

                    resultX = Mathf.Clamp(resultX, 0, maxX);
                    resultY = Mathf.Clamp(resultY, 0, maxY);

                    if (gridManager.GetBlock(new Vector2Int(resultX, resultY)) != null)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }