/// <summary> /// Convenience method to check if all connected children are accepted. /// </summary> /// <param name="children">The children we want to adopt.</param> /// <returns>Returns if the connector will accept the children.</returns> public bool AcceptsChildren(Connector conn) { List <BaseNode> children = new List <BaseNode>(conn.ChildCount); for (int i = 0; i < conn.ChildCount; ++i) { BaseNode node = conn.GetChild(i); // if the owner itself is part of the list we ignore him if (node == Owner) { continue; } //one child can't be as child of Owner if (!node.CanBeAdoptedBy(Owner)) { return(false); } children.Add(node); } return(AcceptsChildren(children)); }
/// <summary> /// Checks if a new node can be adopted by this one. /// </summary> /// <param name="child">The node we want to adopt.</param> /// <returns>Returns true if this node can adopt the given child.</returns> public virtual bool CanAdopt(BaseNode child) { return child != null && child.CanBeAdoptedBy(this); }
/// <summary> /// Checks if a new node can be adopted by this one. /// </summary> /// <param name="child">The node we want to adopt.</param> /// <returns>Returns true if this node can adopt the given child.</returns> public virtual bool CanAdopt(BaseNode child) { return(child != null && child.CanBeAdoptedBy(this)); }