breaking: removed unnecessary 'initialize' parameter from InterestManagement.OnRebuildObservers

This commit is contained in:
vis2k 2022-02-26 15:26:04 +08:00
parent c1e05d9df4
commit 66eff281c7
7 changed files with 8 additions and 9 deletions

View File

@ -32,7 +32,7 @@ public override bool OnCheckObserver(NetworkIdentity identity, NetworkConnection
return Vector3.Distance(identity.transform.position, newObserver.identity.transform.position) < range;
}
public override void OnRebuildObservers(NetworkIdentity identity, HashSet<NetworkConnectionToClient> newObservers, bool initialize)
public override void OnRebuildObservers(NetworkIdentity identity, HashSet<NetworkConnectionToClient> newObservers)
{
// cache range and .transform because both call GetComponent.
int range = GetVisRange(identity);

View File

@ -137,7 +137,7 @@ public override bool OnCheckObserver(NetworkIdentity identity, NetworkConnection
return identityNetworkMatch.matchId == newObserverNetworkMatch.matchId;
}
public override void OnRebuildObservers(NetworkIdentity identity, HashSet<NetworkConnectionToClient> newObservers, bool initialize)
public override void OnRebuildObservers(NetworkIdentity identity, HashSet<NetworkConnectionToClient> newObservers)
{
if (!identity.TryGetComponent<NetworkMatch>(out NetworkMatch networkMatch))
return;

View File

@ -94,7 +94,7 @@ public override bool OnCheckObserver(NetworkIdentity identity, NetworkConnection
return identity.gameObject.scene == newObserver.identity.gameObject.scene;
}
public override void OnRebuildObservers(NetworkIdentity identity, HashSet<NetworkConnectionToClient> newObservers, bool initialize)
public override void OnRebuildObservers(NetworkIdentity identity, HashSet<NetworkConnectionToClient> newObservers)
{
if (!sceneObjects.TryGetValue(identity.gameObject.scene, out HashSet<NetworkIdentity> objects))
return;

View File

@ -52,7 +52,7 @@ public override bool OnCheckObserver(NetworkIdentity identity, NetworkConnection
return (projected - observerProjected).sqrMagnitude <= 2;
}
public override void OnRebuildObservers(NetworkIdentity identity, HashSet<NetworkConnectionToClient> newObservers, bool initialize)
public override void OnRebuildObservers(NetworkIdentity identity, HashSet<NetworkConnectionToClient> newObservers)
{
// add everyone in 9 neighbour grid
// -> pass observers to GetWithNeighbours directly to avoid allocations

View File

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;
namespace Mirror
@ -145,7 +144,7 @@ public override bool OnCheckObserver(NetworkIdentity identity, NetworkConnection
return identityNetworkTeam.teamId == newObserverNetworkTeam.teamId;
}
public override void OnRebuildObservers(NetworkIdentity identity, HashSet<NetworkConnectionToClient> newObservers, bool initialize)
public override void OnRebuildObservers(NetworkIdentity identity, HashSet<NetworkConnectionToClient> newObservers)
{
// If this object doesn't have a NetworkTeam then it's visible to all clients
if (!identity.TryGetComponent<NetworkTeam>(out NetworkTeam networkTeam))

View File

@ -54,7 +54,7 @@ public virtual void Reset() {}
//
// Mirror maintains .observing automatically in the background. best of
// both worlds without any worrying now!
public abstract void OnRebuildObservers(NetworkIdentity identity, HashSet<NetworkConnectionToClient> newObservers, bool initialize);
public abstract void OnRebuildObservers(NetworkIdentity identity, HashSet<NetworkConnectionToClient> newObservers);
// helper function to trigger a full rebuild.
// most implementations should call this in a certain interval.

View File

@ -1442,7 +1442,7 @@ static void RebuildObserversCustom(NetworkIdentity identity, bool initialize)
// not force hidden?
if (identity.visible != Visibility.ForceHidden)
{
aoi.OnRebuildObservers(identity, newObservers, initialize);
aoi.OnRebuildObservers(identity, newObservers);
}
// IMPORTANT: AFTER rebuilding add own player connection in any case