コード例 #1
0
        /// <summary>
        /// Removes node from tree.
        /// <param name="node">The node to be removed.</param>
        /// <param name="includeHierarchy">If true, the hierarchy will also be removed.</param>
        /// </summary>
        public void RemoveNode(ActionNode node, bool includeHierarchy)
        {
            GetNodes();
            var        nodes  = new List <ActionNode>(m_Nodes);
            BranchNode branch = node as BranchNode;

            // Remove children
            if (includeHierarchy && branch != null)
            {
                foreach (ActionNode n in branch.GetHierarchy())
                {
                    nodes.Remove(n);
                }
            }

            // Remove node
            nodes.Remove(node);
            m_Nodes = nodes.ToArray();

            if (Application.isPlaying && this.enabled)
            {
                // Update function nodes
                m_FunctionNodes = this.GetFunctionNodes();
                // Reset status
                node.ResetStatus();
                // Disable node
                node.OnDisable();
            }

            HierarchyChanged();
        }
コード例 #2
0
        /// <summary>
        /// Removes node from tree.
        /// <param name="node">The node to be removed.</param>
        /// <param name="includeHierarchy">If true, the hierarchy will also be removed.</param>
        /// </summary>
        public void RemoveNode(ActionNode node, bool includeHierarchy)
        {
            GetNodes();
            var        nodes  = new List <ActionNode>(m_Nodes);
            BranchNode branch = node as BranchNode;

            // Remove children
            if (includeHierarchy && branch != null)
            {
                {
                    var __array3       = branch.GetHierarchy();
                    var __arrayLength3 = __array3.Length;
                    for (int __i3 = 0; __i3 < __arrayLength3; ++__i3)
                    {
                        var n = (ActionNode)__array3[__i3];
                        {
                            nodes.Remove(n);
                        }
                    }
                }
            }

            // Remove node
            nodes.Remove(node);
            m_Nodes = nodes.ToArray();

            if (Application.isPlaying && this.enabled)
            {
                // Update function nodes
                m_FunctionNodes = this.GetFunctionNodes();
                // Reset status
                node.ResetStatus();
                // Disable node
                node.OnDisable();
            }

            HierarchyChanged();
        }
コード例 #3
0
        /// <summary>
        /// Removes node from tree.
        /// <param name="node">The node to be removed.</param>
        /// <param name="includeHierarchy">If true, the hierarchy will also be removed.</param>
        /// </summary>
        public void RemoveNode (ActionNode node, bool includeHierarchy) {
            GetNodes();
            var nodes = new List<ActionNode>(m_Nodes);
            BranchNode branch = node as BranchNode;

            // Remove children
            if (includeHierarchy && branch != null) {
                foreach (ActionNode n in branch.GetHierarchy()) {
                    nodes.Remove(n);
                }
            }

            // Remove node
            nodes.Remove(node);
            m_Nodes = nodes.ToArray();

            if (Application.isPlaying && this.enabled)  {
                // Update function nodes
                m_FunctionNodes = this.GetFunctionNodes();
                // Reset status
                node.ResetStatus();
                // Disable node
                node.OnDisable();
            }

            HierarchyChanged();
        }