diff --git a/Assets/Scripts/Networking/Clientside/ClientSyncer.cs b/Assets/Scripts/Networking/Clientside/ClientSyncer.cs index 1e424f8..e7db3f3 100644 --- a/Assets/Scripts/Networking/Clientside/ClientSyncer.cs +++ b/Assets/Scripts/Networking/Clientside/ClientSyncer.cs @@ -8,8 +8,15 @@ namespace Cyber.Networking.Clientside { /// public class ClientSyncer : Syncer { + /// + /// Creates a Client syncer, constructor only defined because of inheritance of . + /// public ClientSyncer() : base(1f / 10) {} + /// + /// Performs a client sync tick. + /// + /// The number of the tick, which can be used to determine a few things, like when to sync certain things. public override void PerformTick(int Tick) { ClientSyncPkt SyncPkt = new ClientSyncPkt(); diff --git a/Assets/Scripts/Networking/Serverside/ServerSyncer.cs b/Assets/Scripts/Networking/Serverside/ServerSyncer.cs index 6b73708..77f3e96 100644 --- a/Assets/Scripts/Networking/Serverside/ServerSyncer.cs +++ b/Assets/Scripts/Networking/Serverside/ServerSyncer.cs @@ -3,7 +3,6 @@ using Cyber.Entities; using Cyber.Networking.Messages; using System; using System.Collections.Generic; -using UnityEngine; namespace Cyber.Networking.Serverside { @@ -17,6 +16,9 @@ namespace Cyber.Networking.Serverside { private List QueuedSyncs = new List(); private List DirtySyncBases = new List(); + /// + /// Creates a Server syncer, constructor only defined because of inheritance of . + /// public ServerSyncer() : base(1f / 10) {} /// @@ -31,9 +33,9 @@ namespace Cyber.Networking.Serverside { } /// - /// + /// Performs a server sync tick. /// - /// + /// The number of the tick, which can be used to determine a few things, like when to sync certain things. public override void PerformTick(int Tick) { var Categorized = Database.GetCategorizedDatabase(); List checksummedIds = new List(); diff --git a/Assets/Scripts/Networking/Syncer.cs b/Assets/Scripts/Networking/Syncer.cs index eedf964..b7b9ca4 100644 --- a/Assets/Scripts/Networking/Syncer.cs +++ b/Assets/Scripts/Networking/Syncer.cs @@ -3,7 +3,9 @@ using UnityEngine; namespace Cyber.Networking { - + /// + /// An abstract syncer, used by and . + /// public abstract class Syncer : MonoBehaviour { private int TickCounter = 0; @@ -13,15 +15,29 @@ namespace Cyber.Networking { private int SyncPacketID = 0; + /// + /// Initializes the syncer, basically just sets the . + /// + /// public Syncer(float tickInterval) { TickInterval = tickInterval; TimeSinceLastTick = tickInterval; } + /// + /// Returns the next ID for a sync packet. + /// + /// public int NextSyncID() { return SyncPacketID++; } + /// + /// Performs a tick on the syncer, called from . + /// + /// The tick number, used to e.g. determine when to sync certain things. + public abstract void PerformTick(int Tick); + private void Update() { TimeSinceLastTick += Time.deltaTime; @@ -38,7 +54,5 @@ namespace Cyber.Networking { } } - public abstract void PerformTick(int Tick); - } }