mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
47 lines
2.2 KiB
Plaintext
47 lines
2.2 KiB
Plaintext
using UnityEngine;
|
|
using Mirror;
|
|
using System.Collections.Generic;
|
|
|
|
/*
|
|
Visibility Guide: https://mirror-networking.com/docs/Guides/Visibility.html
|
|
Documentation: https://mirror-networking.com/docs/Guides/NetworkBehaviour.html
|
|
API Reference: https://mirror-networking.com/docs/api/Mirror.NetworkBehaviour.html
|
|
*/
|
|
|
|
public class #SCRIPTNAME# : NetworkBehaviour
|
|
{
|
|
#region Observers
|
|
|
|
/// <summary>
|
|
/// Callback used by the visibility system to (re)construct the set of observers that can see this object.
|
|
/// <para>Implementations of this callback should add network connections of players that can see this object to the observers set.</para>
|
|
/// </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>
|
|
/// <returns>true when overwriting so that Mirror knows that we wanted to rebuild observers ourselves. otherwise it uses built in rebuild.</returns>
|
|
public override bool OnRebuildObservers(HashSet<NetworkConnection> observers, bool initialize)
|
|
{
|
|
return base.OnRebuildObservers(observers, initialize);
|
|
}
|
|
|
|
/// <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 visibile 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 override void OnSetHostVisibility(bool visible) { }
|
|
|
|
/// <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>
|
|
public override bool OnCheckObserver(NetworkConnection conn)
|
|
{
|
|
return base.OnCheckObserver(conn);
|
|
}
|
|
|
|
#endregion
|
|
}
|