Ejemplo n.º 1
0
    public void AI()
    {
        if (path.Count == 0)
        {
            path = pathGenerator.DijkstarPathFind(test.graph, test.start, test.end);
        }

        destination    = path[pathIndex].ToNode.gameObject;
        hasDestination = true;


        float distanceToTarget = Vector3.SqrMagnitude(destination.transform.position - tf.position);

        if (RotateTowards(destination))
        {
        }
        else if (distanceToTarget > buffer * buffer)
        {
            Move();
        }
        else if (distanceToTarget <= buffer * buffer)
        {
            pathIndex++;
            if (pathIndex >= path.Count)
            {
            }
            else
            {
            }
        }
    }
Ejemplo n.º 2
0
 void GetPath()
 {
     path = pathGenerator.DijkstarPathFind(graph, start, end);
 }