quakeball/Assets/Scripts/Net/NetworkHandler.cs

27 lines
711 B
C#

using UnityEngine;
using NeonTea.Quakeball.Net.Endpoint;
using System.Threading;
namespace NeonTea.Quakeball.Net {
public class Network {
public static Network Singleton = new Network();
private AbstractEndpoint Endpoint;
public void Start(AbstractEndpoint endpoint, string host, int port) {
if (Endpoint != null) {
Debug.Log("Can not start multiple endpoints at once! Use Server if multiple connections are required.");
return;
}
Endpoint = endpoint;
Endpoint.Start(host, port);
}
public void Stop() {
Endpoint.Stop();
Endpoint = null;
}
}
}