Esempio n. 1
0
        public ScriptNode ReplaceScriptNode <T>(WildcardNode wildcard, ScriptNode scriptNode) where T : struct, IScriptNodeJob
        {
            Nodes.Remove(wildcard.Name);

            AddScriptNode <T>(scriptNode, wildcard.Name);
            scriptNode.Speed = wildcard.Speed;

            for (int i = 0; i < wildcard.InputPorts.Count; i++)
            {
                var      inputPort = wildcard.InputPorts[i];
                NodeLink link      = inputPort.Link;

                wildcard.Disconnect(link);
                var newInputPort = scriptNode.CreateBaseInputPort(inputPort.Weight);
                scriptNode.Connect(newInputPort, link.OutputPort);
            }

            for (int i = 0; i < wildcard.OutputPorts.Count; i++)
            {
                var      outputPort = wildcard.OutputPorts[i];
                NodeLink link       = outputPort.Link;

                link.InputPort.Node.Disconnect(link);
                link.InputPort.Node.Connect(link.InputPort, scriptNode);
            }

            Behaviour.PlayableGraph.DestroyPlayable(wildcard.Playable);

            return(scriptNode);
        }
Esempio n. 2
0
 public void DisconnectedNode(NodeLink link) => OnNodeDisconnected?.Invoke(link);
Esempio n. 3
0
 public void ConnectedNode(NodeLink link) => OnNodeConnected?.Invoke(link);