Esempio n. 1
0
        // Highlights nodes that can be aborted by the currently selected node.
        private void highlightAsAbortable(BonsaiNode node)
        {
            // Root must exist.
            if (!window.tree.Root)
            {
                return;
            }

            BonsaiNode selected = window.inputHandler.SelectedNode;

            // A node must be selected.
            if (selected == null)
            {
                return;
            }

            var aborter = selected.behaviour as ConditionalAbort;

            // The selected node must be a conditional abort.
            if (aborter)
            {
                // Highlight this node if it can be aborted by the selected aborter.
                if (ConditionalAbort.IsAbortable(aborter, node.behaviour))
                {
                    backgroundStyle.normal.background = _abortHighlightTex;
                }
            }
        }
Esempio n. 2
0
        protected internal override void OnAbort(ConditionalAbort child)
        {
            if (IsChild(child))
            {
                sortPriorities();

                for (int i = 0; i < _childrenOrder.Length; ++i)
                {
                    // Match found, start from this priority node.
                    if (child._indexOrder == _childrenOrder[i])
                    {
                        _currentChildIndex = i;
                        break;
                    }
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Highlights nodes that are being re-evaluated, like abort nodes or
        /// children under reactive parents.
        /// </summary>
        /// <param name="node"></param>
        private void highlightAsReevaluated(BonsaiNode node)
        {
            if (!EditorApplication.isPlaying)
            {
                return;
            }

            BehaviourIterator itr = node.behaviour.Iterator;

            if (itr != null && itr.IsRunning)
            {
                var           aborter     = node.behaviour as ConditionalAbort;
                BehaviourNode currentNode = window.tree.GetNode(itr.CurrentIndex);

                // Only highlight the abort if the current running node can be aborted by it.
                if (aborter && ConditionalAbort.IsAbortable(aborter, currentNode))
                {
                    backgroundStyle.normal.background = _reevaluateHighlightTex;
                }
            }
        }
 public override void OnAbort(ConditionalAbort child)
 {
     // Do nothing. Parallel branches have same priority.
 }
Esempio n. 5
0
 private void OnAbortSelected(object sender, ConditionalAbort abort)
 {
     UpdateOrderIndices();
 }
Esempio n. 6
0
 public override void OnAbort(ConditionalAbort child)
 {
     highestUtilityChild = child.ChildOrder;
 }