A game about forced loneliness, made by TACStudios
1using System.Collections.Generic;
2using System.Linq;
3
4namespace Unity.VisualScripting
5{
6 /// <summary>
7 /// Returns the sum of two objects.
8 /// </summary>
9 [UnitCategory("Math/Generic")]
10 [UnitTitle("Add")]
11 public sealed class GenericSum : Sum<object>
12 {
13 public override object Operation(object a, object b)
14 {
15 return OperatorUtility.Add(a, b);
16 }
17
18 public override object Operation(IEnumerable<object> values)
19 {
20 var valueList = values.ToList();
21 var result = OperatorUtility.Add(valueList[0], valueList[1]);
22
23 for (int i = 2; i < valueList.Count; i++)
24 {
25 result = OperatorUtility.Add(result, valueList[i]);
26 }
27
28 return result;
29 }
30 }
31}