Exemplo n.º 1
0
    /// <summary>
    /// Draws a line between two waypoints.
    /// </summary>
    /// <param name="start">The starting waypoint of the line.</param>
    /// <param name="end">The ending waypoint of the line.</param>
    private void DrawLine(Waypoint start, Waypoint end)
    {
        PathLine line = Instantiate(lineRenderer) as PathLine;

        line.SetEndpoints(start.transform.position, end.transform.position);
        line.transform.parent = pathLines.transform;
    }
Exemplo n.º 2
0
 /// <summary>
 /// Constantly draws a line between the user and the next waypoint.
 /// </summary>
 private void Update()
 {
     if (userLine != null)
     {
         if (items.Length > currentIndex)
         {
             if (currentPath == null)
             {
                 FindTargetWaypoint();
                 currentPath = navigator.DrawShortestPath(navigator.GetClosestWaypoint(user.transform.position), targetWaypoint);
             }
             userLine.SetEndpoints(user.transform.position + Vector3.down * 0.5f, currentPath[0].transform.position);
         }
         else
         {
             userLine.gameObject.SetActive(false);
         }
     }
 }