Ejemplo n.º 1
0
    public void setPath(Vector3[] wayPoints)
    {
        ways = wayPoints;
        path = new Path_AI(wayPoints, transform.position, turnDst);

        if (Application.isPlaying)
        {
            StopCoroutine("FollowPath2");
            StartCoroutine("FollowPath2");
        }
    }
Ejemplo n.º 2
0
    private void Start()
    {
        rb = GetComponent <Rigidbody>();
        Vector3[] waypoints = GameObject.Find(myNavMesh).GetComponent <NavMeshCreator>().optimizedPath.ToArray();

        Vector3 navMeshPos = GameObject.Find(myNavMesh).transform.position;

        for (int i = 0; i < waypoints.Length; i++)
        {
            waypoints[i] += navMeshPos;
        }
        ways = waypoints;
        path = new Path_AI(ways, transform.position, turnDst);

        StopCoroutine("FollowPath2");
        StartCoroutine("FollowPath2");
    }