feat: client & server behaviours added

This commit is contained in:
2025-10-28 08:35:34 +03:00
parent 599774ea8b
commit 4ed049573a
2 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
using Engine.Core;
namespace Engine.Systems.Network;
/// <summary>
/// Basic client behaviour that finds the <see cref="INetworkCommunicatorClient"/> in the universe in it's first active frame.
/// <br/>
/// Disclaimer: It implements <see cref="IFirstFrameUpdate"/> and <see cref="ILastFrameUpdate"/> in virtual methods.
/// </summary>
public class ClientBehaviour : Behaviour, IFirstFrameUpdate, ILastFrameUpdate
{
public INetworkCommunicatorClient Client { get; private set; } = null!;
public virtual void FirstActiveFrame() => Client = Universe.FindRequiredBehaviour<INetworkCommunicatorClient>();
public virtual void LastActiveFrame() => Client = null!;
}

View File

@@ -0,0 +1,16 @@
using Engine.Core;
namespace Engine.Systems.Network;
/// <summary>
/// Basic server behaviour that finds the <see cref="INetworkCommunicatorServer"/> in the universe in it's first active frame.
/// <br/>
/// Disclaimer: It implements <see cref="IFirstFrameUpdate"/> and <see cref="ILastFrameUpdate"/> in virtual methods.
/// </summary>
public class ServerBehaviour : Behaviour, IFirstFrameUpdate, ILastFrameUpdate
{
public INetworkCommunicatorServer Server { get; private set; } = null!;
public virtual void FirstActiveFrame() => Server = Universe.FindRequiredBehaviour<INetworkCommunicatorServer>();
public virtual void LastActiveFrame() => Server = null!;
}