BREAKING CHANGE: renamed original Behaviour class to BehaviourInternal, and replaced it with BehaviourBase

Original Behaviour was using old methods for detecting entering/exiting universe,
they are now all under the same hood and the original is kept for UniverseEntranceManager
because it needs to enter the universe without itself. The internal behaviour kept under
a subnamespace of "Core.Internal" for the purpose that it might come in handy for other use cases.
This commit is contained in:
2025-10-22 16:50:19 +03:00
parent 2f32038f04
commit 988a6f67f2
23 changed files with 194 additions and 185 deletions

View File

@@ -10,7 +10,7 @@ namespace Engine.Systems.Network;
/// <summary>
/// Intermediary manager that looks up in it's hierarchy for a <see cref="INetworkCommunicator"/> to route/broadcast it's received packets to their destinations.
/// </summary>
public class NetworkManager : Behaviour, INetworkManager
public class NetworkManager : Behaviour, IEnterUniverse, IExitUniverse, INetworkManager
{
private readonly Dictionary<Type, Dictionary<Type, List<MethodInfo>>> clientPacketArrivalMethods = [];
private readonly Dictionary<Type, Dictionary<Type, List<MethodInfo>>> serverPacketArrivalMethods = [];
@@ -230,8 +230,8 @@ public class NetworkManager : Behaviour, INetworkManager
UnregisterPacketRoutersFor(removedBehaviour, serverPacketRouters, serverPacketArrivalMethods);
}
protected override void OnExitedUniverse(IUniverse universe) => _networkEntityCollector.Unassign();
protected override void OnEnteredUniverse(IUniverse universe)
public void ExitUniverse(IUniverse universe) => _networkEntityCollector.Unassign();
public void EnterUniverse(IUniverse universe)
{
_networkEntityCollector.Assign(universe);
NetworkCommunicator = BehaviourController.GetRequiredBehaviourInParent<INetworkCommunicator>();