示例#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;
                }
            }
        }
示例#2
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;
                }
            }
        }