namespace Fusion.Addons.KCC { public sealed class SmoothFloat : SmoothValue { // CONSTRUCTORS public SmoothFloat(int records) : base(records) { } // PUBLIC METHODS public void FilterValues(bool positive, bool negative) { SmoothItem[] items = Items; SmoothItem item; if (positive == true) { for (int i = 0, count = items.Length; i < count; ++i) { item = items[i]; if (item.Value > 0.0f) { item.Value = 0.0f; } } } if (negative == true) { for (int i = 0, count = items.Length; i < count; ++i) { item = items[i]; if (item.Value < 0.0f) { item.Value = 0.0f; } } } } // SmoothValue INTERFACE protected override float GetDefaultValue() { return 0.0f; } protected override float AccumulateValue(float accumulatedValue, float value, double scale) { return (float)(accumulatedValue + value * scale); } protected override float GetSmoothValue(float accumulatedValue, double scale) { return (float)(accumulatedValue * scale); } } }