Create NetworkManager, Client, and Hud

This commit is contained in:
2024-12-22 05:56:05 -08:00
parent 5a0d82b0fc
commit 186c2e186e
6 changed files with 276 additions and 0 deletions

18
code/NetworkManager.cs Normal file
View 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;
}
}