public void TakeSnapshot(Grilla <Nodo> grid, Nodo current, List <Nodo> openList, List <Nodo> closedList)
    {
        GridSnapshotAction gridSnapshotAction = new GridSnapshotAction();

        gridSnapshotAction.AddAction(HideNodeVisuals);

        for (int x = 0; x < grid.GetWidth(); x++)
        {
            for (int y = 0; y < grid.GetHeight(); y++)
            {
                Nodo Nodo = grid.GetGridObject(x, y);

                int     CostoG         = Nodo.CostoG;
                int     CostoH         = Nodo.CostoH;
                int     CostoF         = Nodo.CostoF;
                Vector3 gridPosition   = new Vector3(Nodo.x, Nodo.y) * grid.GetCellSize() + Vector3.one * grid.GetCellSize() * .5f;
                bool    isCurrent      = Nodo == current;
                bool    isInOpenList   = openList.Contains(Nodo);
                bool    isInClosedList = closedList.Contains(Nodo);
                int     tmpX           = x;
                int     tmpY           = y;

                gridSnapshotAction.AddAction(() => {
                    Transform visualNode = visualNodeArray[tmpX, tmpY];
                    SetupVisualNode(visualNode, CostoG, CostoH, CostoF);

                    Color backgroundColor = UtilsClass.GetColorFromString("636363");

                    if (isInClosedList)
                    {
                        backgroundColor = new Color(1, 0, 0);
                    }
                    if (isInOpenList)
                    {
                        backgroundColor = UtilsClass.GetColorFromString("009AFF");
                    }
                    if (isCurrent)
                    {
                        backgroundColor = new Color(0, 1, 0);
                    }

                    visualNode.Find("sprite").GetComponent <SpriteRenderer>().color = backgroundColor;
                });
            }
        }

        gridSnapshotActionList.Add(gridSnapshotAction);
    }
    public void Setup(Grilla <CasillaNodo> grid)
    {
        visualNodeArray = new Transform[grid.GetWidth(), grid.GetHeight()];

        for (int x = 0; x < grid.GetWidth(); x++)
        {
            for (int y = 0; y < grid.GetHeight(); y++)
            {
                Vector3   gridPosition = new Vector3(x, y) * grid.GetCellSize() + Vector3.one * grid.GetCellSize() * .5f;
                Transform visualNode   = CreateVisualNode(gridPosition);
                visualNodeArray[x, y] = visualNode;
                visualNodeList.Add(visualNode);
            }
        }
        HideNodeVisuals();
    }
    public void TakeSnapshotFinalPath(Grilla <CasillaNodo> grid, List <CasillaNodo> path)
    {
        GridSnapshotAction gridSnapshotAction = new GridSnapshotAction();

        gridSnapshotAction.AddAction(HideNodeVisuals);

        for (int x = 0; x < grid.GetWidth(); x++)
        {
            for (int y = 0; y < grid.GetHeight(); y++)
            {
                CasillaNodo CasillaNodo = grid.GetGridObject(x, y);


                Vector3 gridPosition = new Vector3(CasillaNodo.x, CasillaNodo.y) * grid.GetCellSize() + Vector3.one * grid.GetCellSize() * .5f;
                bool    isInPath     = path.Contains(CasillaNodo);
                int     tmpX         = x;
                int     tmpY         = y;

                gridSnapshotAction.AddAction(() => {
                    Transform visualNode = visualNodeArray[tmpX, tmpY];


                    Color backgroundColor;

                    if (isInPath)
                    {
                        backgroundColor = new Color(0, 1, 0);
                    }
                    else
                    {
                        backgroundColor = UtilsClass.GetColorFromString("636363");
                    }

                    visualNode.Find("sprite").GetComponent <SpriteRenderer>().color = backgroundColor;
                });
            }
        }

        gridSnapshotActionList.Add(gridSnapshotAction);
    }