diff --git a/Scripts/Node.cs b/Scripts/Node.cs index 3f3c083..503219e 100644 --- a/Scripts/Node.cs +++ b/Scripts/Node.cs @@ -1,7 +1,5 @@ using System; -using System.Collections; using System.Collections.Generic; -using System.Linq; using UnityEngine; /// Base class for all nodes @@ -16,12 +14,13 @@ public abstract class Node : ScriptableObject { Always } - /// Name of the node + /// Parent [SerializeField] public NodeGraph graph; + /// Position on the [SerializeField] public Vector2 position; /// Input s. It is recommended not to modify these at hand. Instead, see [SerializeField] public List inputs = new List(); - /// Output s. It is recommended not to modify these at hand. Instead, see + /// Output s. It is recommended not to modify these at hand. Instead, see [SerializeField] public List outputs = new List(); public int InputCount { get { return inputs.Count; } } @@ -65,6 +64,8 @@ public abstract class Node : ScriptableObject { return null; } + /// Returns a value based on requested port output. Should be overridden before used. + /// The requested port. public virtual object GetValue(NodePort port) { Debug.LogWarning("No GetValue(NodePort port) override defined for " + GetType()); return null; @@ -77,21 +78,7 @@ public abstract class Node : ScriptableObject { /// Output Input public virtual void OnCreateConnection(NodePort from, NodePort to) { } - public int GetInputId(NodePort input) { - for (int i = 0; i < inputs.Count; i++) { - if (input == inputs[i]) return i; - - } - return -1; - } - public int GetOutputId(NodePort output) { - for (int i = 0; i < outputs.Count; i++) { - if (output == outputs[i]) return i; - - } - return -1; - } - + /// Disconnect everything from this node public void ClearConnections() { for (int i = 0; i < inputs.Count; i++) { inputs[i].ClearConnections();