Exemple #1
0
        /// <summary>
        /// Connects to another block
        /// </summary>
        /// <param name="block"></param>
        public void ConnectTo(BlockBase block)
        {
            if (OutputNodes.Count == 0 || block.InputNodes.Count == 0)
            {
                return;
            }

            var outputNode = OutputNodes.FirstOrDefault(it => it.ConnectingNode == null);
            var inputNode  = block.InputNodes.FirstOrDefault(it => it.ConnectingNode == null);

            if (outputNode == null)
            {
                outputNode = OutputNodes[0];
            }
            if (inputNode == null)
            {
                inputNode = block.InputNodes[0];
            }
            outputNode.ConnectTo(inputNode);
        }
Exemple #2
0
 /// <summary>
 /// Create a single output node in a block
 /// </summary>
 internal static List <BlockOutputNode> CreateSingleOutput(ref BlockBase root)
 {
     return(new List <BlockOutputNode> {
         new BlockOutputNode(ref root, "Output", "Out")
     });
 }
Exemple #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="root">The block object thar contains this node</param>
 /// <param name="name">Name of the output</param>
 /// <param name="shortName">Short name</param>
 public BlockOutputNode(ref BlockBase root, string name, string shortName, string description = "") : base(ref root, name, shortName)
 {
     Object           = new List <Object>();
     this.Description = description;
 }
Exemple #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="root">The block object thar contains this node</param>
 /// <param name="name">Name of the input</param>
 /// <param name="shortName">Short name</param>
 public BlockInputNode(ref BlockBase root, string name, string shortName, string description = "") : base(ref root, name, shortName)
 {
     this.Description = description;
 }
Exemple #5
0
 /// <summary>
 /// Create a single input node in a block
 /// </summary>
 internal static List <BlockInputNode> CreateSingleInputSignal(ref BlockBase root)
 {
     return(new List <BlockInputNode> {
         new BlockInputNode(ref root, "Signal", "In")
     });
 }
Exemple #6
0
 /// <summary>
 /// Creates the input and output nodes
 /// </summary>
 /// <param name="root"></param>
 protected abstract void CreateNodes(ref BlockBase root);