Пример #1
0
 public void Setup()
 {
     // start server/client
     NetworkServer.Listen(1);
     NetworkClient.ConnectHost();
     NetworkServer.SpawnObjects();
     NetworkServer.ActivateHostScene();
     NetworkClient.ConnectLocalServer();
     NetworkServer.localConnection.isAuthenticated = true;
     NetworkClient.connection.isAuthenticated      = true;
     NetworkClient.Ready();
 }
Пример #2
0
        public IEnumerator UnitySetUp()
        {
            Transport.activeTransport = new GameObject().AddComponent <MemoryTransport>();

            // start server and wait 1 frame
            NetworkServer.Listen(1);
            yield return(null);

            // connection host and wait 1 frame
            NetworkClient.ConnectHost();
            NetworkClient.ConnectLocalServer();
            yield return(null);
        }
Пример #3
0
        // fully connect HOST client to local server
        // sets NetworkServer.localConnection / NetworkClient.connection.
        protected void ConnectHostClientBlocking()
        {
            NetworkClient.ConnectHost();
            NetworkClient.ConnectLocalServer();
            UpdateTransport();
            Assert.That(NetworkServer.connections.Count, Is.EqualTo(1));

            // set isSpawnFinished flag.
            // so that any Spawn() calls will call OnStartClient and set isClient=true
            // for the client objects.
            // otherwise this would only happen after AddPlayerForConnection.
            // but not all tests have a player.
            NetworkClient.isSpawnFinished = true;
        }
Пример #4
0
        public void Setup()
        {
            Transport.activeTransport = new GameObject().AddComponent <MemoryTransport>();

            // start server/client
            NetworkServer.Listen(1);
            NetworkClient.ConnectHost();
            NetworkServer.SpawnObjects();
            NetworkServer.ActivateHostScene();
            NetworkClient.ConnectLocalServer();

            NetworkServer.localConnection.isAuthenticated = true;
            NetworkClient.connection.isAuthenticated      = true;

            ClientScene.Ready(NetworkClient.connection);
        }
Пример #5
0
 /// <summary>
 /// connect host mode
 /// </summary>
 public void ConnectLocalServer()
 {
     NetworkClient.ConnectLocalServer();
 }