Exemple #1
0
    public void AI()
    {
        if (path.Count == 0)
        {
            path = pathGenerator.AStarPathFind(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)
            {
                return;
            }
            else
            {
            }
        }
    }
Exemple #2
0
 void GetPath()
 {
     path = pathGenerator.AStarPathFind(graph, start, end);
 }