Esempio n. 1
0
        public void TearDown()
        {
            Object.DestroyImmediate(gameObject);

            // reset all state
            server.Disconnect();
            Object.DestroyImmediate(serverGO);
        }
Esempio n. 2
0
        public void AddAllReadyServerConnectionsToObservers()
        {
            var connection1 = new NetworkConnection(tconn42)
            {
                IsReady = true
            };
            var connection2 = new NetworkConnection(tconn43)
            {
                IsReady = false
            };

            // add some server connections
            server.connections.Add(connection1);
            server.connections.Add(connection2);

            // add a host connection
            (_, IConnection localConnection) = PipeConnection.CreatePipe();

            server.SetLocalConnection(client, localConnection);
            server.LocalConnection.IsReady = true;

            // call OnStartServer so that observers dict is created
            identity.StartServer();

            // add all to observers. should have the two ready connections then.
            identity.AddAllReadyServerConnectionsToObservers();
            Assert.That(identity.observers, Is.EquivalentTo(new[] { connection1, server.LocalConnection }));

            // clean up
            server.Disconnect();
        }
    public void OnApplicationQuit()
    {
        Debug.Log("Application received quit signal");
#if SERVER
        server.Disconnect();
#endif
#if CLIENT
        client.Disconnect();
#endif
    }
Esempio n. 4
0
        public IEnumerator TearDown()
        {
            // shutdown
            Server.Disconnect();
            yield return(null);

            // unload scene
            Scene scene = SceneManager.GetSceneByPath(ScenePath);

            yield return(SceneManager.UnloadSceneAsync(scene));
        }
Esempio n. 5
0
        public IEnumerator ShutdownHost() => UniTask.ToCoroutine(async() =>
        {
            client.Disconnect();
            server.Disconnect();

            await AsyncUtil.WaitUntilWithTimeout(() => !client.Active);
            await AsyncUtil.WaitUntilWithTimeout(() => !server.Active);

            Object.DestroyImmediate(playerPrefab);
            Object.DestroyImmediate(serverGo);
            Object.DestroyImmediate(clientGo);
            Object.DestroyImmediate(serverPlayerGO);
            Object.DestroyImmediate(clientPlayerGO);

            ExtraTearDown();
        });
Esempio n. 6
0
        public IEnumerator ShutdownHost() => RunAsync(async() =>
        {
            client.Disconnect();
            server.Disconnect();

            await WaitFor(() => !client.Active);
            await WaitFor(() => !server.Active);

            Object.DestroyImmediate(playerPrefab);
            Object.DestroyImmediate(serverGo);
            Object.DestroyImmediate(clientGo);
            Object.DestroyImmediate(serverPlayerGO);
            Object.DestroyImmediate(clientPlayerGO);

            ExtraTearDown();
        });
Esempio n. 7
0
 public void ShutdownNetworkServer()
 {
     GameObject.DestroyImmediate(identity.gameObject);
     server.Disconnect();
     GameObject.DestroyImmediate(serverGO);
 }