Create NetworkManager, Client, and Hud
This commit is contained in:
18
code/NetworkManager.cs
Normal file
18
code/NetworkManager.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace LuckerParty;
|
||||
|
||||
/// <summary>
|
||||
/// Listens to Network events and creates Client GameObjects
|
||||
/// </summary>
|
||||
public sealed class NetworkManager : Component, Component.INetworkListener
|
||||
{
|
||||
[Property] private GameObject ClientGroup { get; set; }
|
||||
|
||||
public void OnActive( Connection channel )
|
||||
{
|
||||
var gameObject = new GameObject( ClientGroup ) { Name = $"{channel.DisplayName} ({channel.SteamId})" };
|
||||
gameObject.NetworkSpawn( channel );
|
||||
|
||||
var client = gameObject.AddComponent<Client>();
|
||||
client.Connection = channel;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user