1
This commit is contained in:
34
Packages/Common~/Extensions/Netcode/NetcodeManager.cs
Normal file
34
Packages/Common~/Extensions/Netcode/NetcodeManager.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Unity.Netcode;
|
||||
using UnityEngine.Events;
|
||||
namespace BITKit
|
||||
{
|
||||
public class NetcodeManager : MonoBehaviour
|
||||
{
|
||||
public NetworkManager networkManager;
|
||||
public UnityEvent onServerStarted = new();
|
||||
public UnityEvent<ulong> onClientConnectedCallback = new();
|
||||
public UnityEvent<ulong> onClientDisconnectCallback = new();
|
||||
void Start()
|
||||
{
|
||||
networkManager.OnServerStarted += onServerStarted.Invoke;
|
||||
networkManager.OnClientConnectedCallback += onClientConnectedCallback.Invoke;
|
||||
networkManager.OnClientDisconnectCallback += onClientDisconnectCallback.Invoke;
|
||||
}
|
||||
public void StartHost()
|
||||
{
|
||||
networkManager.StartHost();
|
||||
}
|
||||
public void StartClient()
|
||||
{
|
||||
networkManager.StartClient();
|
||||
}
|
||||
public void Disconnect()
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user