Exemplo n.º 1
0
        // Update is called once per frame
        void Update()
        {
            if (Input.GetMouseButtonDown(0))
            {
                Vector2Int      pos  = m_pathFinder.Grid.GetXy(WorldUtils.GetMousePositionWithZ());
                List <PathNode> path = m_pathFinder.FindPath(Vector2Int.zero, pos);

                if (path == null)
                {
                    return;
                }

                for (var i = 0; i < path.Count - 1; i++)
                {
                    path[i].SetSelected(true);
                    m_pathFinder.Grid.RefreshValue(path[i].Position.x, path[i].Position.y);
                }
            }
        }