This commit is contained in:
vis2k 2021-03-09 15:40:12 +08:00
parent dd2b4f8736
commit 6b9acacaf0

View File

@ -257,38 +257,22 @@ internal void SetClientOwner(NetworkConnection conn)
static uint nextNetworkId = 1;
internal static uint GetNextNetworkId() => nextNetworkId++;
/// <summary>
/// Resets nextNetworkId = 1
/// </summary>
/// <summary>Resets nextNetworkId = 1</summary>
public static void ResetNextNetworkId() => nextNetworkId = 1;
/// <summary>
/// The delegate type for the clientAuthorityCallback.
/// </summary>
/// <param name="conn">The network connection that is gaining or losing authority.</param>
/// <param name="identity">The object whose client authority status is being changed.</param>
/// <param name="authorityState">The new state of client authority of the object for the connection.</param>
/// <summary>The delegate type for the clientAuthorityCallback.</summary>
public delegate void ClientAuthorityCallback(NetworkConnection conn, NetworkIdentity identity, bool authorityState);
/// <summary>
/// A callback that can be populated to be notified when the client-authority state of objects changes.
/// <para>Whenever an object is spawned with client authority, or the client authority status of an object is changed with AssignClientAuthority or RemoveClientAuthority, then this callback will be invoked.</para>
/// <para>This callback is only invoked on the server.</para>
/// </summary>
/// <summary> A callback that can be populated to be notified when the client-authority state of objects changes.</summary>
public static event ClientAuthorityCallback clientAuthorityCallback;
/// <summary>
/// this is used when a connection is destroyed, since the "observers" property is read-only
/// </summary>
/// <param name="conn"></param>
// this is used when a connection is destroyed, since the "observers" property is read-only
internal void RemoveObserverInternal(NetworkConnection conn)
{
observers?.Remove(conn.connectionId);
}
/// <summary>
/// hasSpawned should always be false before runtime
/// </summary>
// hasSpawned should always be false before runtime
[SerializeField, HideInInspector] bool hasSpawned;
public bool SpawnedFromInstantiate { get; private set; }