/// <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(); }
/// <summary> /// Call ResetStatus in child. /// <summary> public override void ResetStatus() { // Call base ResetStatus base.ResetStatus(); // Call ResetStatus in child. if (m_Child != null) { m_Child.ResetStatus(); } }
/// <summary> /// Removes the node from this branch. /// <param name = "child">The object to be removed from the list.</param> /// </summary> public override void Remove(ActionNode child) { if (Contains(child)) { // Remove child var newChildren = new List <ActionNode>(m_Children); newChildren.Remove(child); m_Children = newChildren.ToArray(); if (child != null && child.branch == this) { child.branch = null; } // Call ResetStatus if it is playing if (Application.isPlaying) { child.ResetStatus(); } } }
/// <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(); }
/// <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(); }
/// <summary> /// Removes the node from this branch. /// <param name = "child">The object to be removed from the list.</param> /// </summary> public override void Remove (ActionNode child) { if (Contains(child)) { // Remove child var newChildren = new List<ActionNode>(m_Children); newChildren.Remove(child); m_Children = newChildren.ToArray(); if (child != null && child.branch == this) child.branch = null; // Call ResetStatus if it is playing if (Application.isPlaying) child.ResetStatus(); } }