Beispiel #1
0
        public NavShape(Nav2D nav2D, List <IntPoint> points, bool hole, List <PolyNode> children, NavShape parent, NavElement.Type navType)
        {
            Points = new Vector2[points.Count];

            for (int i = 0; i < Points.Length; ++i)
            {
                Points[i] = nav2D.ParseToVector2(points[i]);
            }

            Hole    = hole;
            NavType = navType;
            Parent  = parent;

            if (children == null || children.Count == 0)
            {
                Children = null;
                return;
            }

            Children = new List <NavShape>();

            foreach (var child in children)
            {
                Children.Add(new NavShape(nav2D, child.Contour, child.IsHole, child.Childs, this, navType));
            }
        }
Beispiel #2
0
 internal ElementsGroup(Nav2D nav2D)
 {
     _Nav2D       = nav2D;
     Id           = _Nav2D.NextElementsGroupId;
     Obstacles    = new HashSet <NavElement>();
     Surfaces     = new HashSet <NavElement>();
     NavObstacles = new List <NavShape>();
     NavSurfaces  = new List <NavShape>();
     isDirty      = true;
 }