Beispiel #1
0
 private void OnDrawGizmos()
 {
     Waypoint[] waypointArray = this.FindChildrenPoints();
     if ((waypointArray != null) && (waypointArray.Length > 0))
     {
         Gizmos.color = this.color;
         for (int i = 0; i < (waypointArray.Length - 1); i++)
         {
             Vector3 position   = waypointArray[i].gameObject.transform.position;
             Vector3 a          = waypointArray[i + 1].gameObject.transform.position;
             Vector3 vector4    = a - position;
             Vector3 normalized = vector4.normalized;
             float   num2       = (Vector3.Distance(a, position) - waypointArray[i + 1].radius) - waypointArray[i].radius;
             position += (Vector3)(normalized * waypointArray[i].radius);
             a         = position + ((Vector3)(normalized * num2));
             DrawArrowHelper.Draw(position, a, this.arrowHeadLength, 20f);
             if (this.colorizeWaypoints)
             {
                 waypointArray[i + 1].color = this.color;
             }
         }
         Gizmos.DrawIcon(new Vector3(waypointArray[0].transform.position.x, waypointArray[0].transform.position.y + (waypointArray[0].radius * 3.5f), waypointArray[0].transform.position.z), "StartPoint", true);
         Gizmos.DrawIcon(new Vector3(waypointArray[waypointArray.Length - 1].transform.position.x, waypointArray[waypointArray.Length - 1].transform.position.y + (waypointArray[waypointArray.Length - 1].radius * 3.5f), waypointArray[waypointArray.Length - 1].transform.position.z), "EndPoint", true);
     }
 }
 private void OnDrawGizmos()
 {
     Waypoint[] array = this.FindChildrenPoints();
     if (array != null && array.Length > 0)
     {
         Gizmos.color = this.color;
         for (int i = 0; i < array.Length - 1; i++)
         {
             Vector3 vector     = array[i].gameObject.transform.position;
             Vector3 vector2    = array[i + 1].gameObject.transform.position;
             Vector3 normalized = (vector2 - vector).normalized;
             float   d          = Vector3.Distance(vector2, vector) - array[i + 1].radius - array[i].radius;
             vector += normalized * array[i].radius;
             vector2 = vector + normalized * d;
             DrawArrowHelper.Draw(vector, vector2, this.arrowHeadLength, 20f);
             if (this.colorizeWaypoints)
             {
                 array[i + 1].color = this.color;
             }
         }
         Gizmos.DrawIcon(new Vector3(array[0].transform.position.x, array[0].transform.position.y + array[0].radius * 3.5f, array[0].transform.position.z), "StartPoint", true);
         Gizmos.DrawIcon(new Vector3(array[array.Length - 1].transform.position.x, array[array.Length - 1].transform.position.y + array[array.Length - 1].radius * 3.5f, array[array.Length - 1].transform.position.z), "EndPoint", true);
     }
 }
Beispiel #3
0
 public static void Draw(Vector3 StartPos, Vector3 EndPos, Color color, float arrowHeadLength = 0.25f, float arrowHeadAngle = 20f)
 {
     Gizmos.color = color;
     DrawArrowHelper.Draw(StartPos, EndPos, arrowHeadLength, arrowHeadAngle);
 }