Esempio n. 1
0
 public virtual void OnDrawGizmos()
 {
     Gizmos.matrix = Matrix4x4.identity;
     LineSegment2D[] _borders               = new LineSegment2D[0];
     AreaPathNode[]  _areaPathNodes         = new AreaPathNode[0];
     AreaPathNode[]  uncheckedAreaPathNodes = new AreaPathNode[1] {
         rootAreaPathNode
     };
     LineSegment2D[] borderPair;
     while (uncheckedAreaPathNodes.Length > 0)
     {
         if (uncheckedAreaPathNodes[0] != null)
         {
             foreach (AreaPathNode childAreaPathNode in uncheckedAreaPathNodes[0].children)
             {
                 if (childAreaPathNode != null && childAreaPathNode.gameObject.activeInHierarchy)
                 {
                     if (_areaPathNodes.Contains(childAreaPathNode))
                     {
                         Debug.LogError("AreaPath " + name + " has a cycle");
                         return;
                     }
                     borderPair   = GetBorders(uncheckedAreaPathNodes[0], childAreaPathNode);
                     _borders     = _borders.AddRange(borderPair);
                     Gizmos.color = borderColor;
                     Gizmos.DrawLine(borderPair[0].start, borderPair[0].end);
                     Gizmos.DrawLine(borderPair[1].start, borderPair[1].end);
                     Gizmos.color = nodeConnectorColor;
                     Gizmos.DrawLine(uncheckedAreaPathNodes[0].trs.position, childAreaPathNode.trs.position);
                 }
             }
             if (uncheckedAreaPathNodes[0].gameObject.activeInHierarchy)
             {
                 uncheckedAreaPathNodes = uncheckedAreaPathNodes.AddRange(uncheckedAreaPathNodes[0].children);
                 _areaPathNodes         = _areaPathNodes.Add(uncheckedAreaPathNodes[0]);
             }
         }
         uncheckedAreaPathNodes = uncheckedAreaPathNodes.RemoveAt(0);
     }
     borders       = _borders;
     areaPathNodes = _areaPathNodes;
 }