コード例 #1
0
 /// <summary>
 /// Updates the behavior.
 /// </summary>
 /// <param name="behavior">The behavior.</param>
 internal void UpdateBehavior(NetworkBehavior behavior)
 {
     if (!behavior.CreatedByBehavior && behavior.NeedSyncComponentsUpdatingComponentsToSync())
     {
         var message = this.CreateNetworkBehaviorMessage(behavior.NetworkBehaviorId, behavior.FactoryId, NetworkSyncType.Update);
         behavior.WriteSyncData(message, behavior.ComponentsToSync);
         this.networkService.SendToServer(message, DeliveryMethod.UnreliableSequenced);
     }
 }
コード例 #2
0
        /// <summary>
        /// Sends the response to recreate this entity.
        /// </summary>
        /// <param name="behavior">The behavior.</param>
        private void SendResponseToRecreateThisEntity(NetworkBehavior behavior)
        {
            var responseMessage = this.CreateNetworkBehaviorMessage(behavior.NetworkBehaviorId, behavior.FactoryId, NetworkSyncType.Create);

            if (behavior.FactoryId == SerializationFactoryId)
            {
                this.WriteEntity(responseMessage, behavior.Owner);
            }

            behavior.WriteSyncData(responseMessage, behavior.NetworkSyncComponents);
            this.networkService.SendToServer(responseMessage, DeliveryMethod.ReliableOrdered);
        }