feat: client & server behaviours added
This commit is contained in:
		
							
								
								
									
										16
									
								
								Engine.Systems/Network/ClientBehaviour.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								Engine.Systems/Network/ClientBehaviour.cs
									
									
									
									
									
										Normal 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!;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										16
									
								
								Engine.Systems/Network/ServerBehaviour.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								Engine.Systems/Network/ServerBehaviour.cs
									
									
									
									
									
										Normal 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!;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user