/// <summary> /// Populates the given 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(GopherRobotNode node) { if (node.Mesh == null) { throw new NullReferenceException("ERROR: The Mesh member of node was null"); } var tempJoints = robot.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 GopherRobotNode { Mesh = robot.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, GopherRobotNode child) { children.Add(joint, child); child.parentConnection = joint; child.parent = this; child.Level = (ushort)(Level + 1); joint.Child = child; joint.Parent = parent; }