18 lines
543 B
C#
Raw Normal View History

2022-01-14 18:15:48 -08:00
using Mirror;
using System;
2021-11-26 17:36:14 +00:00
namespace QSB.Utility.VariableSync
{
2022-01-14 22:46:01 -08:00
public class FloatVariableSyncer : BaseVariableSyncer
2022-01-14 18:15:48 -08:00
{
private float _prevValue;
[NonSerialized]
public float Value;
protected override bool HasChanged() => Value != _prevValue;
protected override void UpdatePrevData() => _prevValue = Value;
protected override void Serialize(NetworkWriter writer, bool initialState) => writer.Write(Value);
protected override void Deserialize(NetworkReader reader, bool initialState) => Value = reader.Read<float>();
2022-01-14 18:15:48 -08:00
}
2021-11-26 17:36:14 +00:00
}