17 lines
		
	
	
		
			676 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			676 B
		
	
	
	
		
			C#
		
	
	
	
	
	
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!;
 | 
						|
}
 |