Ejemplo n.º 1
0
 /// <summary>
 /// Called when the network authority on networkIdentity is changed.
 /// </summary>
 /// <param name="networkAuthority">New network authority</param>
 protected virtual void OnNetworkAuthorityChanged(NetworkAuthority networkAuthority)
 {
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a network authority message to set the network authority on a network identity.
        /// </summary>
        /// <param name="clientMessage">Indicates if this is a client message.</param>
        public static byte[] createNetworkAuthorityMessage(NetworkIdentity netIdentity, NetworkAuthority netAuthority, bool clientMessage = false)
        {
            List <byte> msgBytes = new List <byte>();

            byte msgHeader = (byte)(clientMessage ? 7 : 6);                        //Change message header to indicate if it's a client message or not

            msgBytes.Add(msgHeader);                                               //Message Header

            msgBytes.AddRange(netIdentity.networkID.serialize());                  //Identity of the GameObject on the network

            msgBytes.Add((byte)(netAuthority == NetworkAuthority.CLIENT ? 1 : 0)); //Network authority of object

            return(msgBytes.ToArray());
        }