Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        gc = GameObject.FindWithTag("GameController").GetComponent<GameController>();
        //cache this for later
        firstPoint = startPoint.startingNavPoint;
        dfs = new DFS(firstPoint);
        //pops the top off the stack which is just the first point
        nextPoint = dfs.GetNextNavPoint();
        //put us at the start point if we're not
        if (Vector3.Distance(transform.position, nextPoint.position) > 0.05f)
            transform.position = nextPoint.position;
        //find our actual next point
        nextPoint = dfs.GetNextNavPoint();

        agent = GetComponent<NavMeshAgent>();
        agent.updateRotation = false;
        SetDestination(nextPoint.position);
        foundTribute = false;
    }