private void Awake() { if (Application.isEditor) _remotePort = 20001; CURRENT = this; DontDestroyOnLoad(this); _localIP = GetIPAddress(); UPnPHelper.RESULT += BindUPnPResult; ClientConnection = new ClientToClient(); _clientManager = GetComponent<ClientManager>(); ServerConnection = new ClientToServerConnection(ClientConnection); ServerConnection.GameLoad += LoadGame; ServerConnection.GameStart += StartGame; BindUPnP(); }
public ClientToServerConnection(ClientToClient clientConnection) { _clientConnection = clientConnection; _udpRegisterTimer = new Timer(_udpRegisterInterval); _udpRegisterTimer.Elapsed += UdpRegisterCallBack; }
private void Start() { _updateTimer = new Timer(_updateInterval); _updateTimer.Elapsed += UpdateTimer_Elapsed; _updateTimer.AutoReset = true; _connection = GameSession.CURRENT.ClientConnection; _connection.Received += Connection_Received; }