/// <summary> /// Populates the referenced node one level down /// </summary> /// <param name="node"></param> /// <returns> /// Returns true if the node is a 'leaf' (if it has no children) /// </returns> private bool PopulateNode(GopherFieldNode node) { if (node.Mesh == null) { throw new NullReferenceException("ERROR: The Mesh member of node was null"); } var tempJoints = field.GetChildJoints(node.Mesh.MeshID); if (tempJoints.Count == 0) { node.IsLeaf = true; return(true); } else { node.IsLeaf = false; foreach (var joint in tempJoints) { node.AddChild(joint, new GopherFieldNode { Mesh = field.GetMesh(joint.Meta.ChildID) }); } } return(false); }
/// <summary> /// Adds the given node as a child of this node /// </summary> /// <param name="joint">The joint connecting this node to the child</param> /// <param name="child">The child node</param> public void AddChild(GopherJoint_Base joint, GopherFieldNode child) { Children.Add(joint, child); child.parentConnection = joint; child.parent = this; joint.Child = child; joint.Parent = parent; child.Level = (ushort)(Level + 1); }