Class AuthorityManager
public sealed class AuthorityManager
- Inheritance
-
AuthorityManager
Constructors
AuthorityManager(IClient, CoherenceBridge)
public AuthorityManager(IClient client, CoherenceBridge bridge)
Parameters
client
IClientbridge
CoherenceBridge
Methods
AbandonAuthority(NetworkEntityState)
Transfers ownership of the game object to the replication server, making it an orphan. The game object must be persistent, transferable and simulated by this client. The transfer fails if isSimulated is false, lifetimeType is SessionBased or authorityTransferType is NotTransferable.
public bool AbandonAuthority(NetworkEntityState state)
Parameters
state
NetworkEntityState
Returns
- bool
true if the authority transfer was successful, or false if it failed.
Adopt(NetworkEntityState)
Requests authority over an orphaned entity. Works only if isOrphaned is 'true'.
public bool Adopt(NetworkEntityState state)
Parameters
state
NetworkEntityState
Returns
- bool
true if calling this method succeeded. (The authority request itself can still fail.)
RequestAuthority(NetworkEntityState, AuthorityType)
Try to get authority over this entity. Listen to the events OnAuthorityGained and OnAuthorityTransferRejected to get notified whether the request succeeded or not.
public bool RequestAuthority(NetworkEntityState state, AuthorityType authorityType)
Parameters
state
NetworkEntityStateauthorityType
AuthorityType
Returns
- bool
true if calling this method succeeded. (The authority request itself can still fail.)
TransferAuthority(NetworkEntityState, ClientID, AuthorityType)
Give away authority over this entity to another client. Requires that this client currently has authority.
public bool TransferAuthority(NetworkEntityState state, ClientID clientID, AuthorityType authorityTransferred = AuthorityType.Full)
Parameters
state
NetworkEntityStateRepresentation of the Network Entity that you wish to transfer authority of.
clientID
ClientIDClientID of the client that should get authority over this entity. ClientID can be retrieved from the ClientConnections.
authorityTransferred
AuthorityTypeType of authority transferred.
Returns
- bool
True if calling this method succeeded. (The authority request itself can still fail.)