@@ -191,59 +191,59 @@ internal static void HandleSpawnPoolObject(uint clientId, BitReader reader, int
191
191
float yRot = reader . ReadFloat ( ) ;
192
192
float zRot = reader . ReadFloat ( ) ;
193
193
194
- SpawnManager . spawnedObjects [ netId ] . transform . position = new Vector3 ( xPos , yPos , zPos ) ;
195
- SpawnManager . spawnedObjects [ netId ] . transform . rotation = Quaternion . Euler ( xRot , yRot , zRot ) ;
196
- SpawnManager . spawnedObjects [ netId ] . gameObject . SetActive ( true ) ;
194
+ SpawnManager . SpawnedObjects [ netId ] . transform . position = new Vector3 ( xPos , yPos , zPos ) ;
195
+ SpawnManager . SpawnedObjects [ netId ] . transform . rotation = Quaternion . Euler ( xRot , yRot , zRot ) ;
196
+ SpawnManager . SpawnedObjects [ netId ] . gameObject . SetActive ( true ) ;
197
197
}
198
198
199
199
internal static void HandleDestroyPoolObject ( uint clientId , BitReader reader , int channelId )
200
200
{
201
201
uint netId = reader . ReadUInt ( ) ;
202
- SpawnManager . spawnedObjects [ netId ] . gameObject . SetActive ( false ) ;
202
+ SpawnManager . SpawnedObjects [ netId ] . gameObject . SetActive ( false ) ;
203
203
}
204
204
205
205
internal static void HandleChangeOwner ( uint clientId , BitReader reader , int channelId )
206
206
{
207
207
uint netId = reader . ReadUInt ( ) ;
208
208
uint ownerClientId = reader . ReadUInt ( ) ;
209
- if ( SpawnManager . spawnedObjects [ netId ] . OwnerClientId == netManager . LocalClientId )
209
+ if ( SpawnManager . SpawnedObjects [ netId ] . OwnerClientId == netManager . LocalClientId )
210
210
{
211
211
//We are current owner.
212
- SpawnManager . spawnedObjects [ netId ] . InvokeBehaviourOnLostOwnership ( ) ;
212
+ SpawnManager . SpawnedObjects [ netId ] . InvokeBehaviourOnLostOwnership ( ) ;
213
213
}
214
214
if ( ownerClientId == netManager . LocalClientId )
215
215
{
216
216
//We are new owner.
217
- SpawnManager . spawnedObjects [ netId ] . InvokeBehaviourOnGainedOwnership ( ) ;
217
+ SpawnManager . SpawnedObjects [ netId ] . InvokeBehaviourOnGainedOwnership ( ) ;
218
218
}
219
- SpawnManager . spawnedObjects [ netId ] . OwnerClientId = ownerClientId ;
219
+ SpawnManager . SpawnedObjects [ netId ] . OwnerClientId = ownerClientId ;
220
220
}
221
221
222
222
internal static void HandleSyncVarUpdate ( uint clientId , BitReader reader , int channelId )
223
223
{
224
224
uint netId = reader . ReadUInt ( ) ;
225
225
ushort orderIndex = reader . ReadUShort ( ) ;
226
226
227
- if ( ! SpawnManager . spawnedObjects . ContainsKey ( netId ) )
227
+ if ( ! SpawnManager . SpawnedObjects . ContainsKey ( netId ) )
228
228
{
229
229
if ( LogHelper . CurrentLogLevel <= LogLevel . Normal ) LogHelper . LogWarning ( "Sync message recieved for a non existant object with id: " + netId ) ;
230
230
return ;
231
231
}
232
- else if ( SpawnManager . spawnedObjects [ netId ] . GetBehaviourAtOrderIndex ( orderIndex ) == null )
232
+ else if ( SpawnManager . SpawnedObjects [ netId ] . GetBehaviourAtOrderIndex ( orderIndex ) == null )
233
233
{
234
234
if ( LogHelper . CurrentLogLevel <= LogLevel . Normal ) LogHelper . LogWarning ( "Sync message recieved for a non existant behaviour" ) ;
235
235
return ;
236
236
}
237
237
238
- for ( int i = 0 ; i < SpawnManager . spawnedObjects [ netId ] . GetBehaviourAtOrderIndex ( orderIndex ) . syncedVarFields . Count ; i ++ )
238
+ for ( int i = 0 ; i < SpawnManager . SpawnedObjects [ netId ] . GetBehaviourAtOrderIndex ( orderIndex ) . syncedVarFields . Count ; i ++ )
239
239
{
240
240
if ( ! reader . ReadBool ( ) )
241
241
continue ;
242
- SyncedVarField field = SpawnManager . spawnedObjects [ netId ] . GetBehaviourAtOrderIndex ( orderIndex ) . syncedVarFields [ i ] ;
243
- SpawnManager . spawnedObjects [ netId ] . GetBehaviourAtOrderIndex ( orderIndex ) . OnSyncVarUpdate ( FieldTypeHelper . ReadFieldType ( reader ,
242
+ SyncedVarField field = SpawnManager . SpawnedObjects [ netId ] . GetBehaviourAtOrderIndex ( orderIndex ) . syncedVarFields [ i ] ;
243
+ SpawnManager . SpawnedObjects [ netId ] . GetBehaviourAtOrderIndex ( orderIndex ) . OnSyncVarUpdate ( FieldTypeHelper . ReadFieldType ( reader ,
244
244
field . FieldInfo . FieldType , field . FieldValue ) , i ) ;
245
245
}
246
- SpawnManager . spawnedObjects [ netId ] . GetBehaviourAtOrderIndex ( orderIndex ) . OnSyncVarUpdate ( ) ;
246
+ SpawnManager . SpawnedObjects [ netId ] . GetBehaviourAtOrderIndex ( orderIndex ) . OnSyncVarUpdate ( ) ;
247
247
}
248
248
249
249
internal static void HandleAddObjects ( uint clientId , BitReader reader , int channelId )
@@ -299,7 +299,7 @@ internal static void HandleCommand(uint clientId, BitReader reader, int channelI
299
299
uint networkId = reader . ReadUInt ( ) ;
300
300
ushort orderId = reader . ReadUShort ( ) ;
301
301
ulong hash = reader . ReadULong ( ) ;
302
- NetworkedBehaviour behaviour = SpawnManager . spawnedObjects [ networkId ] . GetBehaviourAtOrderIndex ( orderId ) ;
302
+ NetworkedBehaviour behaviour = SpawnManager . SpawnedObjects [ networkId ] . GetBehaviourAtOrderIndex ( orderId ) ;
303
303
if ( clientId != behaviour . OwnerClientId )
304
304
return ; // Not owner
305
305
MethodInfo targetMethod = null ;
@@ -321,7 +321,7 @@ internal static void HandleRpc(uint clientId, BitReader reader, int channelId)
321
321
uint networkId = reader . ReadUInt ( ) ;
322
322
ushort orderId = reader . ReadUShort ( ) ;
323
323
ulong hash = reader . ReadULong ( ) ;
324
- NetworkedBehaviour behaviour = SpawnManager . spawnedObjects [ networkId ] . GetBehaviourAtOrderIndex ( orderId ) ;
324
+ NetworkedBehaviour behaviour = SpawnManager . SpawnedObjects [ networkId ] . GetBehaviourAtOrderIndex ( orderId ) ;
325
325
MethodInfo targetMethod = null ;
326
326
if ( behaviour . cachedMethods . ContainsKey ( hash ) )
327
327
targetMethod = behaviour . cachedMethods [ hash ] ;
@@ -341,7 +341,7 @@ internal static void HandleTargetRpc(uint clientId, BitReader reader, int channe
341
341
uint networkId = reader . ReadUInt ( ) ;
342
342
ushort orderId = reader . ReadUShort ( ) ;
343
343
ulong hash = reader . ReadULong ( ) ;
344
- NetworkedBehaviour behaviour = SpawnManager . spawnedObjects [ networkId ] . GetBehaviourAtOrderIndex ( orderId ) ;
344
+ NetworkedBehaviour behaviour = SpawnManager . SpawnedObjects [ networkId ] . GetBehaviourAtOrderIndex ( orderId ) ;
345
345
MethodInfo targetMethod = null ;
346
346
if ( behaviour . cachedMethods . ContainsKey ( hash ) )
347
347
targetMethod = behaviour . cachedMethods [ hash ] ;
@@ -358,8 +358,8 @@ internal static void HandleSetVisibility(uint clientId, BitReader reader, int ch
358
358
uint networkId = reader . ReadUInt ( ) ;
359
359
bool visibility = reader . ReadBool ( ) ;
360
360
if ( visibility )
361
- SpawnManager . spawnedObjects [ networkId ] . SetFormattedSyncedVarData ( reader ) ;
362
- SpawnManager . spawnedObjects [ networkId ] . SetLocalVisibility ( visibility ) ;
361
+ SpawnManager . SpawnedObjects [ networkId ] . SetFormattedSyncedVarData ( reader ) ;
362
+ SpawnManager . SpawnedObjects [ networkId ] . SetLocalVisibility ( visibility ) ;
363
363
}
364
364
}
365
365
}
0 commit comments