@@ -17,7 +17,14 @@ public class NetworkingManager : MonoBehaviour
1717 /// <summary>
1818 /// A syncronized time, represents the time in seconds since the server application started. Is replicated across all clients
1919 /// </summary>
20- public static float NetworkTime ;
20+ public float NetworkTime
21+ {
22+ get
23+ {
24+ return networkTime ;
25+ }
26+ }
27+ internal float networkTime ;
2128 /// <summary>
2229 /// Gets or sets if the NetworkingManager should be marked as DontDestroyOnLoad
2330 /// </summary>
@@ -37,12 +44,26 @@ public class NetworkingManager : MonoBehaviour
3744 /// <summary>
3845 /// The singleton instance of the NetworkingManager
3946 /// </summary>
40- public static NetworkingManager singleton ;
47+ public static NetworkingManager singleton
48+ {
49+ get
50+ {
51+ return _singleton ;
52+ }
53+ }
54+ private static NetworkingManager _singleton ;
4155 /// <summary>
4256 /// The clientId the server calls the local client by, only valid for clients
4357 /// </summary>
4458 [ HideInInspector ]
45- public int MyClientId ;
59+ public int MyClientId
60+ {
61+ get
62+ {
63+ return myClientId ;
64+ }
65+ }
66+ internal int myClientId ;
4667 internal Dictionary < int , NetworkedClient > connectedClients ;
4768 /// <summary>
4869 /// Gets a dictionary of connected clients
@@ -74,7 +95,14 @@ public bool isHost
7495 /// Gets if we are connected as a client
7596 /// </summary>
7697 [ HideInInspector ]
77- public bool IsClientConnected ;
98+ public bool IsClientConnected
99+ {
100+ get
101+ {
102+ return _isClientConnected ;
103+ }
104+ }
105+ internal bool _isClientConnected ;
78106 /// <summary>
79107 /// The callback to invoke once a client connects
80108 /// </summary>
@@ -110,7 +138,7 @@ private void OnValidate()
110138 Debug . LogWarning ( "MLAPI: All SpawnablePrefabs need a NetworkedObject component. Please add one to the prefab " + SpawnablePrefabs [ i ] . gameObject . name ) ;
111139 continue ;
112140 }
113- netObject . SpawnablePrefabIndex = i ;
141+ netObject . spawnablePrefabIndex = i ;
114142 }
115143 }
116144 if ( DefaultPlayerPrefab != null )
@@ -126,7 +154,7 @@ private void OnValidate()
126154 private ConnectionConfig Init ( NetworkingConfiguration netConfig )
127155 {
128156 NetworkConfig = netConfig ;
129- NetworkTime = 0f ;
157+ networkTime = 0f ;
130158 lastSendTickTime = 0 ;
131159 lastEventTickTime = 0 ;
132160 lastReceiveTickTime = 0 ;
@@ -360,7 +388,7 @@ private void OnEnable()
360388 Destroy ( this ) ;
361389 return ;
362390 }
363- singleton = this ;
391+ _singleton = this ;
364392 if ( DontDestroy )
365393 DontDestroyOnLoad ( gameObject ) ;
366394 if ( RunInBackground )
@@ -369,7 +397,7 @@ private void OnEnable()
369397
370398 private void OnDestroy ( )
371399 {
372- singleton = null ;
400+ _singleton = null ;
373401 Shutdown ( ) ;
374402 }
375403
@@ -420,7 +448,7 @@ private void Update()
420448 return ;
421449 }
422450 else
423- IsClientConnected = false ;
451+ _isClientConnected = false ;
424452
425453 if ( OnClientDisconnectCallback != null )
426454 OnClientDisconnectCallback . Invoke ( clientId ) ;
@@ -481,7 +509,7 @@ private void Update()
481509 if ( isServer )
482510 OnClientDisconnect ( clientId ) ;
483511 else
484- IsClientConnected = false ;
512+ _isClientConnected = false ;
485513
486514 if ( OnClientDisconnectCallback != null )
487515 OnClientDisconnectCallback . Invoke ( clientId ) ;
@@ -497,7 +525,7 @@ private void Update()
497525 NetworkedObject . InvokeSyncvarUpdate ( ) ;
498526 lastEventTickTime = Time . time ;
499527 }
500- NetworkTime += Time . deltaTime ;
528+ networkTime += Time . deltaTime ;
501529 }
502530 }
503531
@@ -673,7 +701,7 @@ private void HandleIncomingData(int clientId, byte[] data, int channelId)
673701 {
674702 using ( BinaryReader messageReader = new BinaryReader ( messageReadStream ) )
675703 {
676- MyClientId = messageReader . ReadInt32 ( ) ;
704+ myClientId = messageReader . ReadInt32 ( ) ;
677705 uint sceneIndex = 0 ;
678706 if ( NetworkConfig . EnableSceneSwitching )
679707 {
@@ -709,7 +737,7 @@ private void HandleIncomingData(int clientId, byte[] data, int channelId)
709737 int msDelay = NetworkTransport . GetRemoteDelayTimeMS ( hostId , clientId , remoteStamp , out error ) ;
710738 if ( ( NetworkError ) error != NetworkError . Ok )
711739 msDelay = 0 ;
712- NetworkTime = netTime + ( msDelay / 1000f ) ;
740+ networkTime = netTime + ( msDelay / 1000f ) ;
713741
714742 connectedClients . Add ( MyClientId , new NetworkedClient ( ) { ClientId = MyClientId } ) ;
715743 int clientCount = messageReader . ReadInt32 ( ) ;
@@ -745,7 +773,7 @@ private void HandleIncomingData(int clientId, byte[] data, int channelId)
745773 }
746774 }
747775 }
748- IsClientConnected = true ;
776+ _isClientConnected = true ;
749777 if ( OnClientConnectedCallback != null )
750778 OnClientConnectedCallback . Invoke ( clientId ) ;
751779 }
@@ -879,7 +907,7 @@ private void HandleIncomingData(int clientId, byte[] data, int channelId)
879907 //We are new owner.
880908 SpawnManager . spawnedObjects [ netId ] . InvokeBehaviourOnGainedOwnership ( ) ;
881909 }
882- SpawnManager . spawnedObjects [ netId ] . OwnerClientId = ownerClientId ;
910+ SpawnManager . spawnedObjects [ netId ] . ownerClientId = ownerClientId ;
883911 }
884912 }
885913 }
0 commit comments