Esempio n. 1
0
        private void DisplayParentNode(BehaviourTree tree, IBehaviourTreeNodeParent node, int level)
        {
            var style = new GUIStyle(GUI.skin.label)
            {
                richText  = true,
                padding   = new RectOffset(10 * level, 0, 0, 0),
                fontStyle = tree.GetRunningNode().Equals(node) ? FontStyle.Bold : FontStyle.Normal
            };

            GUILayout.Label($"<color=#{GetColorByStatus(node.LastStatus)}>{node.GetType().Name}</color>", style);

            foreach (var child in node.Children)
            {
                if (child is IBehaviourTreeNodeParent subParent)
                {
                    DisplayParentNode(tree, subParent, level + 1);
                    continue;
                }

                style.padding   = new RectOffset(10 * (level + 1), 0, 0, 0);
                style.fontStyle = tree.GetRunningNode().Equals(child) ? FontStyle.Bold : FontStyle.Normal;

                GUILayout.Label($"<color=#{GetColorByStatus(child.LastStatus)}>{child.GetType().Name}</color>", style);
            }
        }