ChangeOwner comments

This commit is contained in:
vis2k 2022-03-09 15:54:27 +08:00
parent 8bef2bf864
commit 303b66247e

View File

@ -1288,14 +1288,15 @@ internal static void ChangeOwner(NetworkIdentity identity, ChangeOwnerMessage me
// set localPlayer flag
identity.isLocalPlayer = message.isLocalPlayer;
// identity is now local player. set our static helper field to it.
if (identity.isLocalPlayer)
{
localPlayer = identity;
}
// identity's isLocalPlayer was set false. was it local player before?
else if (localPlayer == identity)
{
// localPlayer may already be assigned to something else
// so only make it null if it's this identity.
localPlayer = null;
identity.OnStopLocalPlayer();
}