Ejemplo n.º 1
0
 /// <summary>
 /// Fixed update for this instance.
 /// </summary>
 void FixedUpdate()
 {
     if (destination != null)
     {
         // If destination reached
         if ((Vector2)destination.transform.position == (Vector2)transform.position)
         {
             // Get next waypoint from my path
             destination = path.GetNextWaypoint(destination, loop);
             if (destination != null)
             {
                 // Set destination for navigation agent
                 navAgent.destination = destination.transform.position;
             }
         }
     }
 }