diff --git a/Scripts/NodePort.cs b/Scripts/NodePort.cs
index 41eb8fa..63f8110 100644
--- a/Scripts/NodePort.cs
+++ b/Scripts/NodePort.cs
@@ -55,7 +55,6 @@ public class NodePort {
}
}
-
/// Return the output value of this node through its parent nodes GetValue override method.
///
public object GetOutputValue() {
@@ -105,6 +104,30 @@ public class NodePort {
return value != null;
}
+ /// Return the sum of all inputs.
+ ///
+ public float GetInputSum(float fallback) {
+ object[] objs = GetInputValues();
+ if (objs.Length == 0) return fallback;
+ float result = 0;
+ for (int i = 0; i < objs.Length; i++) {
+ if (objs[i] is float) result += (float)objs[i];
+ }
+ return result;
+ }
+
+ /// Return the sum of all inputs.
+ ///
+ public int GetInputSum(int fallback) {
+ object[] objs = GetInputValues();
+ if (objs.Length == 0) return fallback;
+ int result = 0;
+ for (int i = 0; i < objs.Length; i++) {
+ if (objs[i] is int) result += (int)objs[i];
+ }
+ return result;
+ }
+
/// Connect this to another
/// The to connect to
public void Connect(NodePort port) {