namespace LuckerParty;
///
/// Listens to Network events and creates Client GameObjects
///
public sealed class NetworkManager : Component, Component.INetworkListener
{
///
/// A GameObject used for organizational grouping of Clients
///
[Property]
private GameObject ClientGroup { get; set; }
public void OnActive( Connection channel )
{
ClientGroup ??= new GameObject( Scene.Root );
var gameObject = new GameObject( ClientGroup ) { Name = $"{channel.DisplayName} ({channel.SteamId})" };
gameObject.NetworkSpawn( channel );
var client = gameObject.AddComponent();
client.Connection = channel;
}
}