using Mirror; using System; using System.Collections.Generic; namespace QSB.Utility.VariableSync { public abstract class BaseVariableSyncer : QSBNetworkBehaviour { protected override float SendInterval => 0.1f; private T _prevValue; [NonSerialized] public T Value; protected override bool HasChanged() => !EqualityComparer.Default.Equals(_prevValue, Value); protected override void UpdatePrevData() => _prevValue = Value; protected override void Serialize(NetworkWriter writer) => writer.Write(Value); protected override void Deserialize(NetworkReader reader) => Value = reader.Read(); } }