refactor: network implementations switched to universe objects
This commit is contained in:
@@ -32,7 +32,7 @@ public class LiteNetLibServer : LiteNetLibCommunicatorBase, INetworkCommunicator
|
||||
|
||||
public INetworkCommunicatorServer Start(int port, int maxConnectionCount, string? password = null)
|
||||
{
|
||||
if (!UniverseObject.IsInUniverse)
|
||||
if (!IsInUniverse)
|
||||
throw new($"{nameof(LiteNetLibServer)} must be in an universe to start");
|
||||
|
||||
Password = password ?? string.Empty;
|
||||
@@ -60,7 +60,17 @@ public class LiteNetLibServer : LiteNetLibCommunicatorBase, INetworkCommunicator
|
||||
return this;
|
||||
}
|
||||
|
||||
protected override void OnEnteredUniverse(IUniverse universe) => universe.OnPostUpdate += PollEvents;
|
||||
protected override void OnExitedUniverse(IUniverse universe) => universe.OnPostUpdate -= PollEvents;
|
||||
private void PollEvents(IUniverse sender, UniverseTime engineTime) => Manager.PollEvents();
|
||||
|
||||
protected override void OnEnteringUniverse(IUniverse universe)
|
||||
{
|
||||
base.OnEnteringUniverse(universe);
|
||||
universe.OnPostUpdate += PollEvents;
|
||||
}
|
||||
|
||||
protected override void OnExitingUniverse(IUniverse universe)
|
||||
{
|
||||
base.OnExitingUniverse(universe);
|
||||
universe.OnPostUpdate -= PollEvents;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user