Exemplo n.º 1
0
    void addNode(NodeType type, Vector2 pos)
    {
        BHEditorNode node = new BHEditorNode(type,
                                             pos,
                                             nodeBoxStyle,
                                             childButtonStyle,
                                             parentButtonStyle);

        node.removeNode = removeNode;

        if (type == NodeType.Action || type == NodeType.Conditional)
        {
            node.setScriptType(script.GetClass());
        }

        _nodes.Add(node);
    }
Exemplo n.º 2
0
    int readBHTreeComponent(int index, out BHEditorNode bhEditorNode)
    {
        BHNodeSerializable serializableNode = behaviourTreeComponent.bhNodesSerializable[index];

        bhEditorNode = new BHEditorNode((NodeType)serializableNode.nodeType,
                                        serializableNode.editorPos,
                                        nodeBoxStyle, childButtonStyle, parentButtonStyle);

        bhEditorNode.setFunctionName(serializableNode.functionName);
        bhEditorNode.removeNode = removeNode;
        bhEditorNode.setScriptType(script.GetClass());

        _nodes.Add(bhEditorNode);

        for (int i = 0; i < serializableNode.childCount; i++)
        {
            BHEditorNode childEditorNode;
            index = readBHTreeComponent(++index, out childEditorNode);
            childEditorNode.setParent(bhEditorNode);
            bhEditorNode.addChild(childEditorNode);
        }

        return(index);
    }