Exemplo n.º 1
0
    void Start()
    {
        // Delete Global and make instantiated here depending on use in detect function
        timer  = 1.0f;
        player = GameObject.FindWithTag("Player");

        GameObject GOtemp;
        Transform  TRANStemp;
        int        random;

        rand = Random.Range(4, 9);

        GOwayPoints = GameObject.FindGameObjectsWithTag("Waypoint");
        for (int i = 0; i < 12; i++)
        {
            GOtemp       = GOwayPoints[i];
            wayPoints[i] = GOtemp.GetComponent <Transform>();
        }


        for (int i = 0; i < 12; i++)
        {
            random            = Random.Range(0, wayPoints.Length);
            TRANStemp         = wayPoints[random];
            wayPoints[random] = wayPoints[i];
            wayPoints[i]      = TRANStemp;
        }

        agent_ = GetComponent <NavMeshAgent>();

        // I don't want my agent to stop or slowdown at waypoints
        agent_.autoBraking = false;

        gotoNextWaypoint_();
    }
Exemplo n.º 2
0
    void Start()
    {
        GameObject GOtemp;
        Transform  TRANStemp;
        int        random;

        rand = Random.Range(4, 9);

        GOwayPoints = GameObject.FindGameObjectsWithTag("Waypoint");
        for (int i = 0; i < 12; i++)
        {
            GOtemp       = GOwayPoints[i];
            wayPoints[i] = GOtemp.GetComponent <Transform>();
        }


        for (int i = 0; i < 12; i++)
        {
            random            = Random.Range(0, wayPoints.Length);
            TRANStemp         = wayPoints[random];
            wayPoints[random] = wayPoints[i];
            wayPoints[i]      = TRANStemp;
        }

        agent_ = GetComponent <NavMeshAgent>();

        // I don't want my agent to stop or slowdown at waypoints
        agent_.autoBraking = false;

        gotoNextWaypoint_();
    }