4.x syntax

This commit is contained in:
Paul Pacheco 2019-01-30 07:39:21 -06:00
parent ca6224d238
commit 306f974e0c

View File

@ -51,7 +51,7 @@ public class NetworkManager : MonoBehaviour
public bool clientLoadedScene;
// only really valid on the server
public int numPlayers { get { return NetworkServer.connections.Count(kv => kv.Value.playerController != null); } }
public int numPlayers => NetworkServer.connections.Count(kv => kv.Value.playerController != null);
// runtime data
public static string networkSceneName = ""; // this is used to make sure that all scene changes are initialized by UNET. loading a scene manually wont set networkSceneName, so UNET would still load it again on start.
@ -261,8 +261,10 @@ public NetworkClient StartClient(ushort hostPort=0)
isNetworkActive = true;
client = new NetworkClient();
client.hostPort = hostPort;
client = new NetworkClient
{
hostPort = hostPort
};
RegisterClientMessages(client);
@ -529,9 +531,11 @@ internal void OnServerAddPlayerMessageInternal(NetworkMessage netMsg)
{
// convert payload to extra message and call OnServerAddPlayer
// (usually for character selection information)
NetworkMessage extraMessage = new NetworkMessage();
extraMessage.reader = new NetworkReader(msg.value);
extraMessage.conn = netMsg.conn;
NetworkMessage extraMessage = new NetworkMessage
{
reader = new NetworkReader(msg.value),
conn = netMsg.conn
};
OnServerAddPlayer(netMsg.conn, extraMessage);
}
else