Example #1
0
        public override Node Copy(bool copyConnections = false)
        {
            FunctionGraph newNode = (FunctionGraph)base.Copy(copyConnections);

            foreach (var node in Nodes.GetAll)
            {
                newNode.Nodes.Add(node.Copy(copyConnections));
            }

            return(newNode);
        }
Example #2
0
        void OnEnable()
        {
            // If no graph is set, disable the component
            if (Graph == null)
            {
                enabled = false; isDisabled = true; return;
            }

            // Clone Graph for runtime
            var cloneGraph = (FunctionGraph)Graph.Copy(true);

            cloneGraph.name += "_" + name;
            cloneGraph.RuntimeInit(this);

            Graph = cloneGraph;
        }
Example #3
0
        public static void Disconnect(Pin pin)
        {
            FunctionGraph graph = pin.Collection.Parent.Root;

            foreach (var conn in pin.Connections)
            {
                var otherNode = graph.Nodes.Find(conn.NodeID);
                if (otherNode == null)
                {
                    continue;
                }
                var otherPin = otherNode.PinCollection.Get(conn.PinName);
                if (otherPin == null)
                {
                    continue;
                }
                otherPin.Connections.RemoveAll(x => x.NodeID == pin.Collection.Parent.ID && x.PinName == pin.Name);
            }
            pin.Connections.Clear();
        }