Exemplo n.º 1
0
    public NodeLink CreateNodeLink(Node _node, string _name, bool _output, DataType _type)
    {
        GameObject obj;

        if (_output == false)
        {
            obj = GameObject.Instantiate(nodeObject.linkPrefab, nodeObject.inputTransform);
        }
        else
        {
            obj = GameObject.Instantiate(nodeObject.linkPrefab, nodeObject.outputTransform);
        }
        NodeLink link = obj.GetComponent <NodeLink>();

        link.Create(_node, _name, _output, _type);
        return(link);
    }
Exemplo n.º 2
0
        internal BuiltData Build()
        {
            var graph = new ProductionGraph();

            foreach (var node in nodes)
            {
                node.Build(graph);
            }

            foreach (var link in links)
            {
                var lhs = link.Item1;
                var rhs = link.Item2;

                foreach (var item in lhs.Built.Outputs.Intersect(rhs.Built.Inputs))
                {
                    NodeLink.Create(lhs.Built, rhs.Built, item);
                }
            }
            return(new BuiltData(graph));
        }