using UnityEngine; namespace Fusion.Addons.SimpleKCC { internal sealed class SmoothVector2 : SmoothValue { public SmoothVector2(int records) : base(records) { } public void FilterValues(bool positiveX, bool negativeX, bool positiveY, bool negativeY) { SmoothItem[] items = base.Items; if (positiveX) { int i = 0; for (int num = items.Length; i < num; i++) { SmoothItem smoothItem = items[i]; if (smoothItem.Value.x > 0f) { smoothItem.Value.x = 0f; } } } if (negativeX) { int j = 0; for (int num2 = items.Length; j < num2; j++) { SmoothItem smoothItem = items[j]; if (smoothItem.Value.x < 0f) { smoothItem.Value.x = 0f; } } } if (positiveY) { int k = 0; for (int num3 = items.Length; k < num3; k++) { SmoothItem smoothItem = items[k]; if (smoothItem.Value.y > 0f) { smoothItem.Value.y = 0f; } } } if (!negativeY) { return; } int l = 0; for (int num4 = items.Length; l < num4; l++) { SmoothItem smoothItem = items[l]; if (smoothItem.Value.y < 0f) { smoothItem.Value.y = 0f; } } } protected override Vector2 GetDefaultValue() { return Vector2.zero; } protected override Vector2 AccumulateValue(Vector2 accumulatedValue, Vector2 value, double scale) { accumulatedValue.x = (float)((double)accumulatedValue.x + (double)value.x * scale); accumulatedValue.y = (float)((double)accumulatedValue.y + (double)value.y * scale); return accumulatedValue; } protected override Vector2 GetSmoothValue(Vector2 accumulatedValue, double scale) { accumulatedValue.x = (float)((double)accumulatedValue.x * scale); accumulatedValue.y = (float)((double)accumulatedValue.y * scale); return accumulatedValue; } } }