Added comments for OnRebuildObservers return value and adjusted NetworkProximityChecker to make this less weird.

This commit is contained in:
vis2k 2018-10-09 10:56:31 +02:00
parent 3f9a423258
commit 6f3a7d7c64
2 changed files with 8 additions and 3 deletions

View File

@ -571,6 +571,8 @@ public virtual void OnStopAuthority()
{
}
// return true when overwriting so that Mirror knows that we wanted to
// rebuild observers ourselves. otherwise it uses built in rebuild.
public virtual bool OnRebuildObservers(HashSet<NetworkConnection> observers, bool initialize)
{
return false;

View File

@ -56,6 +56,8 @@ public override bool OnCheckObserver(NetworkConnection newObserver)
return false;
}
// return true when overwriting so that Mirror knows that we wanted to
// rebuild observers ourselves. otherwise it uses built in rebuild.
public override bool OnRebuildObservers(HashSet<NetworkConnection> observers, bool initial)
{
if (forceHidden)
@ -87,7 +89,7 @@ public override bool OnRebuildObservers(HashSet<NetworkConnection> observers, bo
observers.Add(uv.connectionToClient);
}
}
return true;
break;
}
case CheckMethod.Physics2D:
@ -105,10 +107,11 @@ public override bool OnRebuildObservers(HashSet<NetworkConnection> observers, bo
observers.Add(uv.connectionToClient);
}
}
return true;
break;
}
}
return false;
return true;
}
// called hiding and showing objects on the host