mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkIdentity.DirtyMasks: syntax simplified
This commit is contained in:
parent
54b78251ad
commit
f730b61cb9
@ -844,9 +844,9 @@ internal void OnStopLocalPlayer()
|
|||||||
for (int i = 0; i < components.Length; ++i)
|
for (int i = 0; i < components.Length; ++i)
|
||||||
{
|
{
|
||||||
NetworkBehaviour component = components[i];
|
NetworkBehaviour component = components[i];
|
||||||
|
ulong nthBit = (1u << i);
|
||||||
|
|
||||||
bool dirty = component.IsDirty();
|
bool dirty = component.IsDirty();
|
||||||
ulong nthBit = (1u << i);
|
|
||||||
|
|
||||||
// owner needs to be considered for both SyncModes, because
|
// owner needs to be considered for both SyncModes, because
|
||||||
// Observers mode always includes the Owner.
|
// Observers mode always includes the Owner.
|
||||||
@ -888,11 +888,13 @@ ulong ClientDirtyMask()
|
|||||||
|
|
||||||
// on client, only consider owned components with SyncDirection to server
|
// on client, only consider owned components with SyncDirection to server
|
||||||
NetworkBehaviour component = components[i];
|
NetworkBehaviour component = components[i];
|
||||||
|
ulong nthBit = (1u << i);
|
||||||
|
|
||||||
if (isOwned && component.syncDirection == SyncDirection.ClientToServer)
|
if (isOwned && component.syncDirection == SyncDirection.ClientToServer)
|
||||||
{
|
{
|
||||||
// set the n-th bit if dirty
|
// set the n-th bit if dirty
|
||||||
// shifting from small to large numbers is varint-efficient.
|
// shifting from small to large numbers is varint-efficient.
|
||||||
if (component.IsDirty()) mask |= (1u << i);
|
if (component.IsDirty()) mask |= nthBit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user