BeardedManStudios.Network.NetworkedMonoBehavior.Setup C# (CSharp) Метод

Setup() публичный Метод

Setup this NetworkedMonoBehavior with the owner of this object along with the networked ID
public Setup ( BeardedManStudios.Network.NetWorker owningSocket, bool isOwner, ulong networkId, ulong ownerId, bool isSceneObject = false ) : void
owningSocket BeardedManStudios.Network.NetWorker The socket that owns this object
isOwner bool Is this the owner of this object
networkId ulong Network ID of who owns it
ownerId ulong The network identifyer for the player who owns this object
isSceneObject bool
Результат void
		public override void Setup(NetWorker owningSocket, bool isOwner, ulong networkId, ulong ownerId, bool isSceneObject = false)
		{
			base.Setup(owningSocket, isOwner, networkId, ownerId, isSceneObject);

			bool foundServerAuthority = false, clientPrediction = false;

			foreach (NetworkedMonoBehavior behavior in GetComponents<NetworkedMonoBehavior>())
			{
				if (behavior.serverIsAuthority)
				{
					foundServerAuthority = true;
					clientPrediction = behavior.clientSidePrediction;
					break;
				}
			}

			if (rigidbodyRef != null)
			{
				if ((!OwningNetWorker.IsServer && foundServerAuthority && !clientPrediction) || (!IsOwner && !foundServerAuthority))
				{
					rigidbodyRef.constraints = RigidbodyConstraints.FreezeAll;
					rigidbodyRef.useGravity = false;
				}
			}

			if (isPlayer && OwningNetWorker.IsServer)
				serverTargetPlayer = OwningPlayer;

			if (turnedOffCollider)
			{
				if ((OwningNetWorker.IsServer && foundServerAuthority) || (IsOwner && !foundServerAuthority))
				{
					turnedOffCollider = false;
					colliderRef.enabled = true;
				}
			}
		}