This commit is contained in:
vis2k 2021-03-10 16:30:28 +08:00
parent 459d5e203e
commit 5dd37b5c09

View File

@ -23,30 +23,17 @@ public static class NetworkVisibilityObsoleteMessage
[DisallowMultipleComponent] [DisallowMultipleComponent]
public abstract class NetworkVisibility : NetworkBehaviour public abstract class NetworkVisibility : NetworkBehaviour
{ {
/// <summary> /// <summary>Callback used by the visibility system to determine if an observer (player) can see this object.</summary>
/// Callback used by the visibility system to determine if an observer (player) can see this object.
/// <para>If this function returns true, the network connection will be added as an observer.</para>
/// </summary>
/// <param name="conn">Network connection of a player.</param>
/// <returns>True if the player can see this object.</returns>
//
// Called from NetworkServer.SpawnObserversForConnection the first time // Called from NetworkServer.SpawnObserversForConnection the first time
// a NetworkIdentity is spawned. // a NetworkIdentity is spawned.
public abstract bool OnCheckObserver(NetworkConnection conn); public abstract bool OnCheckObserver(NetworkConnection conn);
/// <summary> /// <summary>Callback used by the visibility system to (re)construct the set of observers that can see this object.</summary>
/// Callback used by the visibility system to (re)construct the set of observers that can see this object. // Implementations of this callback should add network connections of
/// <para>Implementations of this callback should add network connections of players that can see this object to the observers set.</para> // players that can see this object to the observers set.
/// </summary>
/// <param name="observers">The new set of observers for this object.</param>
/// <param name="initialize">True if the set of observers is being built for the first time.</param>
public abstract void OnRebuildObservers(HashSet<NetworkConnection> observers, bool initialize); public abstract void OnRebuildObservers(HashSet<NetworkConnection> observers, bool initialize);
/// <summary> /// <summary>Callback used by the visibility system for objects on a host.</summary>
/// Callback used by the visibility system for objects on a host.
/// <para>Objects on a host (with a local client) cannot be disabled or destroyed when they are not visible to the local client. So this function is called to allow custom code to hide these objects. A typical implementation will disable renderer components on the object. This is only called on local clients on a host.</para>
/// </summary>
/// <param name="visible">New visibility state.</param>
public virtual void OnSetHostVisibility(bool visible) public virtual void OnSetHostVisibility(bool visible)
{ {
foreach (Renderer rend in GetComponentsInChildren<Renderer>()) foreach (Renderer rend in GetComponentsInChildren<Renderer>())