private void InstantiateClient(int userID, int srvPort, Channel clientChannel) { CubeClient cubeClientComponent = Instantiate(clientPrefab); var layer = startingLayer + clientCount; cubeClientComponent.Initialize(serverIP, srvPort, userID, layer, clientChannel, uiPanel, healthText); cubeClientComponent.gameObject.SetActive(true); }
public ClientGame(ClientGameContext ctx) { Assert.IsNotNull(ctx.World); World = ctx.World; //var networkInterface = new LidgrenClientNetworkInterface(ctx.LagSettings); var networkInterface = new LiteNetClientNetworkInterface(); Client = new CubeClient(ctx.World, networkInterface); Client.networkInterface.ConnectionRequestAccepted += OnConnectionRequestAccepted; Client.networkInterface.Disconnected += OnDisconnected; Client.reactor.AddHandler((byte)MessageId.LoadScene, OnLoadScene); Client.reactor.AddHandler((byte)MessageId.PossessPawn, OnPossessPawn); }