mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-18 04:10:36 +00:00
13f5e2ebc3
- spawn authqueue objects with no authority for real instead of with server authority
21 lines
624 B
C#
21 lines
624 B
C#
using Mirror;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace QSB.Utility.VariableSync
|
|
{
|
|
public abstract class BaseVariableSyncer<T> : QSBNetworkBehaviour
|
|
{
|
|
protected override float SendInterval => 0.1f;
|
|
|
|
private T _prevValue;
|
|
[NonSerialized]
|
|
public T Value;
|
|
|
|
protected override bool HasChanged() => !EqualityComparer<T>.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<T>();
|
|
}
|
|
}
|