quakeball/Assets/Scripts/Net/Net.cs
2020-08-02 21:32:30 +03:00

29 lines
759 B
C#

using UnityEngine;
using NeonTea.Quakeball.Net.Peers;
using System.Threading;
namespace NeonTea.Quakeball.Net {
public class Net {
public static Net Singleton = new Net();
private Peer Endpoint;
public void Start(Peer 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(DisconnectReason reason) {
if (Endpoint != null) {
Endpoint.Stop(reason);
Endpoint = null;
}
}
}
}