public SerializedBehaviorTreeNode([NotNull] SerializedBehavior_Base dependedSerializedBehavior,
                                          [NotNull] SerializedBehaviorTreeGraph treeGraph)
        {
            m_dependedSerializedBehavior = dependedSerializedBehavior;
            m_treeGraph = treeGraph;

            Type type = m_dependedSerializedBehavior.serializedBehaviorType;

            title         = TypeHelper.GetUIName(type);
            m_isComposite = type.IsSubclassOf(typeof(Composite));

            Port input = InstantiatePort(Orientation.Horizontal, Direction.Input, Port.Capacity.Single,
                                         typeof(BehaviorConnection));

            input.portName = "Parent";
            inputContainer.Add(input);

            if (m_isComposite)
            {
                var addButton = new Button(AddOutputPortAndNotify)
                {
                    text = "+"
                };
                titleButtonContainer.Add(addButton);
            }

            UIElementsHelper.CreatePropertyElements(new SerializedObject(m_dependedSerializedBehavior),
                                                    extensionContainer);
        }
Example #2
0
 public void Initialize([NotNull] SerializedBehaviorTreeGraph graph)
 {
     m_graph = graph;
 }