Beispiel #1
0
    public NodeMEntity(mEntity entity, Node node, PortOrientation orientation)
    {
        this.orientation = orientation;
        entityName       = entity.entityName;
        parent           = node;

        foreach (IComponent c in entity.components)
        {
            NodeIComponent comp = new NodeIComponent(c, node, orientation);
            comp.parentEntity = this;
            components.Add(comp);
        }

        // tree = PropertyTree.Create(components);
        // if (nodeName=="")
        {
            if (orientation == PortOrientation.Out)
            {
                port = node.AddDynamicOutput(typeof(bool));
            }
            else
            {
                port = node.AddDynamicInput(typeof(bool));
            }

            nodeName = port.fieldName;
        }
        Debug.Log(port.fieldName);
        style             = new NodeMEntityStyle();
        style.unfolded    = false;
        style.portVisible = false;
    }
Beispiel #2
0
    public void init(mEntity entity, Node node, PortOrientation orientation)
    {
        // port = CreateInstance("NodePort") as NodePort;
        this.orientation = orientation;
        this.entity      = entity;
        entityName       = entity.entityName;
        parent           = node;
        Debug.Log("entity components: " + entity.components.Count);
        foreach (IComponent c in entity.components)
        {
            //  NodeIComponent comp = CreateInstance("NodeIComponent") as NodeIComponent;
            //  AssetDatabase.SaveAssets();

            //  comp.init(c, node, this, orientation);
            NodeIComponent comp = new NodeIComponent(c, node, orientation);
            comp.parentEntity = this;
            Debug.Log(comp);
            components.Add(comp);
        }

        // tree = PropertyTree.Create(components);
        //  if (port == null)
        {
            if (orientation == PortOrientation.Out)
            {
                port = node.AddDynamicOutput(typeof(bool));
            }
            else
            {
                port = node.AddDynamicInput(typeof(bool));
            }
        }
        style             = new NodeMEntityStyle();
        style.unfolded    = false;
        style.portVisible = false;
        AssetDatabase.SaveAssets();
    }