Esempio n. 1
0
    private void Update()
    {
        if (Path.Count > 0 && pathIndex < Path.Count)
        {
            var currentNode = debug.GetNode(Path[pathIndex].EndNodeIndex);
            transform.position = Vector3.MoveTowards(transform.position, currentNode.Position, 5 * Time.deltaTime);

            if (Vector3.Distance(transform.position, currentNode.Position) < 0.01)
            {
                pathIndex++;
            }
        }
    }