|
22 | 22 |
|
23 | 23 | namespace MLAPI |
24 | 24 | { |
25 | | - // todo: This is temporary, to be replaced by the tick system |
26 | | - static class TickSystem |
27 | | - { |
28 | | - // todo: this might belong in the tick system, in the end |
29 | | - // special value to indicate "No tick information" |
30 | | - public const ushort k_NoTick = ushort.MaxValue; |
31 | | - // Number of ticks over which the tick number wraps back to 0 |
32 | | - public const ushort k_TickPeriod = k_NoTick - 1; |
33 | | - |
34 | | - public static ushort GetTick() |
35 | | - { |
36 | | - return (ushort)(((long)(Time.time / 0.050)) % k_TickPeriod); |
37 | | - } |
38 | | - } |
39 | | - |
40 | 25 | /// <summary> |
41 | 26 | /// The base class to override to write networked code. Inherits MonoBehaviour |
42 | 27 | /// </summary> |
@@ -542,7 +527,7 @@ internal void InitializeVars() |
542 | 527 | internal static void NetworkedBehaviourUpdate() |
543 | 528 | { |
544 | 529 | // Don't NetworkedBehaviourUpdate more than once per network tick |
545 | | - ushort tick = TickSystem.GetTick(); |
| 530 | + ushort tick = NetworkTickSystem.Instance.GetTick(); |
546 | 531 | if (tick == currentTick) |
547 | 532 | { |
548 | 533 | return; |
@@ -873,7 +858,7 @@ internal static void HandleNetworkedVarUpdate(List<INetworkedVar> networkedVarLi |
873 | 858 |
|
874 | 859 | long readStartPos = stream.Position; |
875 | 860 |
|
876 | | - networkedVarList[i].ReadField(stream, TickSystem.k_NoTick, TickSystem.k_NoTick); |
| 861 | + networkedVarList[i].ReadField(stream, NetworkTickSystem.k_NoTick, NetworkTickSystem.k_NoTick); |
877 | 862 | ProfilerStatManager.networkVarsRcvd.Record(); |
878 | 863 |
|
879 | 864 | if (NetworkingManager.Singleton.NetworkConfig.EnsureNetworkedVarLengthSafety) |
@@ -970,7 +955,7 @@ internal static void SetNetworkedVarData(List<INetworkedVar> networkedVarList, S |
970 | 955 |
|
971 | 956 | long readStartPos = stream.Position; |
972 | 957 |
|
973 | | - networkedVarList[j].ReadField(stream, TickSystem.k_NoTick, TickSystem.k_NoTick); |
| 958 | + networkedVarList[j].ReadField(stream, NetworkTickSystem.k_NoTick, NetworkTickSystem.k_NoTick); |
974 | 959 |
|
975 | 960 | if (NetworkingManager.Singleton.NetworkConfig.EnsureNetworkedVarLengthSafety) |
976 | 961 | { |
|
0 commit comments