void Update()
 {
     // Choose the next destination point when the agent gets
     // close to the current one.
     if (gameController.isGamePaused())
     {
         agent.speed = 0;
         return;
     }
     if (!agent.pathPending && agent.remainingDistance < 0.5f)
     {
         if (!waiting)
         {
             agent.speed = 0;
             waiting     = true;
         }
     }
     if (!waiting)
     {
         agent.speed = agentSpeed;
     }
     else
     {
         agent.speed = 0;
         if (zoneControl.getPlayerInZone() && !waitingForKid)
         {
             waitingForKid = true;
             StartCoroutine(Loiter());
         }
     }
 }
 void Update()
 {
     if (zoneControl.getPlayerInZone() && !waiting)
     {
         waiting = true;
         StartCoroutine(DelayTime());
     }
     if (active)
     {
         agent.destination = playerPosition.position;
         agent.speed       = agentSpeed;
     }
 }
Exemple #3
0
    void Update()
    {
        agent.speed = agentSpeed;


        if (zoneControl.getPlayerInZone() && !waiting)
        {
            Debug.Log("Player is in Zone");
            waiting = true;
            StartCoroutine(Loiter());
        }

        if (agent.remainingDistance < 5f && waiting)
        {
            //agent.transform.position = new Vector3(points[destPoint].position.x, agent.transform.position.y, points[destPoint].position.z);
            GotoNextPoint();
        }
    }