コード例 #1
0
    // Add a child to the container
    public virtual void AddChild( AT_Node node, bool unassigned )
    {
        if (node == null)
        {
            Debug.LogWarning("AT_ContainerNode: Tried to add null node as child");
            return;
        }

         // Set this as the new child's parent
        node.SetParent(this);

        if (unassigned)
        {
            if (!UnassignedChildren_Writable.Contains(node))
            {
                UnassignedChildren_Writable.Add(node);
            }
            else
            {
                Debug.LogWarning("AT_ContainerNode: Failed to add unassigned child because node is already a unassigned child");
            }
        }
        else
        {
            if (!Children_Writable.Contains(node))
            {
                Children_Writable.Add(node);
            }
            else
            {
                Debug.LogWarning("AT_ContainerNode: Failed to add child because node is already a child");
            }
        }
    }
コード例 #2
0
 // Insert a child node at a specific point in the child list
 public void InsertChild(AT_Node node, int index)
 {
     Children_Writable[index] = node;
     node.SetParent(this);
 }