use C#7 out variable declaration

This commit is contained in:
Paul Pacheco 2019-02-22 19:01:24 -06:00
parent 505d2b85ad
commit 6018f4d9db

View File

@ -270,8 +270,7 @@ static bool GetInvokerForHash(int cmdHash, UNetInvokeType invokeType, out Invoke
// InvokeCmd/Rpc/SyncEventDelegate can all use the same function here
internal bool InvokeHandlerDelegate(int cmdHash, UNetInvokeType invokeType, NetworkReader reader)
{
Invoker invoker;
if (GetInvokerForHash(cmdHash, invokeType, out invoker) &&
if (GetInvokerForHash(cmdHash, invokeType, out Invoker invoker) &&
invoker.invokeClass.IsInstanceOfType(this))
{
invoker.invokeFunction(this, reader);
@ -326,8 +325,7 @@ protected GameObject GetSyncVarGameObject(uint netId, ref GameObject gameObjectF
// client always looks up based on netId because objects might get in and out of range
// over and over again, which shouldn't null them forever
NetworkIdentity identity;
if (NetworkIdentity.spawned.TryGetValue(netId, out identity) && identity != null)
if (NetworkIdentity.spawned.TryGetValue(netId, out NetworkIdentity identity) && identity != null)
return identity.gameObject;
return null;
}
@ -372,8 +370,7 @@ protected NetworkIdentity GetSyncVarNetworkIdentity(uint netId, ref NetworkIdent
// client always looks up based on netId because objects might get in and out of range
// over and over again, which shouldn't null them forever
NetworkIdentity identity;
NetworkIdentity.spawned.TryGetValue(netId, out identity);
NetworkIdentity.spawned.TryGetValue(netId, out NetworkIdentity identity);
return identity;
}