using System; using System.Collections.Generic; using UnityEngine; namespace Unity.VisualScripting { /// /// Returns the sum of two or more 2D vectors. /// [UnitCategory("Math/Vector 2")] [UnitTitle("Add")] public sealed class Vector2Sum : Sum, IDefaultValue { [DoNotSerialize] public Vector2 defaultValue => Vector2.zero; public override Vector2 Operation(Vector2 a, Vector2 b) { return a + b; } public override Vector2 Operation(IEnumerable values) { var sum = Vector2.zero; foreach (var value in values) { sum += value; } return sum; } } }