public void Setup() { go = new GameObject(); client = go.AddComponent <NetworkClient>(); server = go.AddComponent <NetworkServer>(); spawner = go.AddComponent <PlayerSpawner>(); sceneManager = go.AddComponent <NetworkSceneManager>(); serverObjectManager = go.AddComponent <ServerObjectManager>(); clientObjectManager = go.AddComponent <ClientObjectManager>(); spawner.sceneManager = sceneManager; sceneManager.client = client; sceneManager.server = server; serverObjectManager.server = server; clientObjectManager.client = client; clientObjectManager.networkSceneManager = sceneManager; spawner.client = client; spawner.server = server; spawner.serverObjectManager = serverObjectManager; spawner.clientObjectManager = clientObjectManager; playerPrefab = new GameObject(); NetworkIdentity playerId = playerPrefab.AddComponent <NetworkIdentity>(); spawner.playerPrefab = playerId; pos1 = new GameObject().transform; pos2 = new GameObject().transform; spawner.startPositions.Add(pos1); spawner.startPositions.Add(pos2); }
public void SetUp() { networkServerGameObject = new GameObject(); server = networkServerGameObject.AddComponent <NetworkServer>(); serverObjectManager = networkServerGameObject.AddComponent <ServerObjectManager>(); serverObjectManager.server = server; networkServerGameObject.AddComponent <NetworkClient>(); gameObject = new GameObject(); identity = gameObject.AddComponent <NetworkIdentity>(); identity.Server = server; identity.ServerObjectManager = serverObjectManager; tconn42 = Substitute.For <IConnection>(); tconn43 = Substitute.For <IConnection>(); }
public static GameObject CreateNetworkManager() { var go = new GameObject("NetworkManager", typeof(NetworkManager), typeof(NetworkServer), typeof(NetworkClient), typeof(NetworkSceneManager), typeof(ServerObjectManager), typeof(ClientObjectManager), typeof(PlayerSpawner), typeof(KcpTransport), typeof(LogSettings)); KcpTransport transport = go.GetComponent <KcpTransport>(); NetworkSceneManager nsm = go.GetComponent <NetworkSceneManager>(); NetworkClient networkClient = go.GetComponent <NetworkClient>(); networkClient.Transport = transport; NetworkServer networkServer = go.GetComponent <NetworkServer>(); networkServer.transport = transport; ServerObjectManager serverObjectManager = go.GetComponent <ServerObjectManager>(); serverObjectManager.server = networkServer; serverObjectManager.networkSceneManager = nsm; ClientObjectManager clientObjectManager = go.GetComponent <ClientObjectManager>(); clientObjectManager.client = networkClient; clientObjectManager.networkSceneManager = nsm; NetworkManager networkManager = go.GetComponent <NetworkManager>(); networkManager.client = networkClient; networkManager.server = networkServer; networkManager.serverObjectManager = serverObjectManager; networkManager.clientObjectManager = clientObjectManager; networkManager.sceneManager = nsm; PlayerSpawner playerSpawner = go.GetComponent <PlayerSpawner>(); playerSpawner.client = networkClient; playerSpawner.server = networkServer; playerSpawner.sceneManager = nsm; playerSpawner.serverObjectManager = serverObjectManager; playerSpawner.clientObjectManager = clientObjectManager; nsm.client = networkClient; nsm.server = networkServer; return(go); }