Exemplo n.º 1
0
        public void SendVariableUpdate(SyncVar var)
        {
            if (!ServerStage.active)
            {
                return;
            }

            NetworkMessage.SyncVarUpdateMessage msg = new NetworkMessage.SyncVarUpdateMessage(instanceId, var.VariableName, var.currentItem);
            ServerStage.SendHighPriorityNetworkMessage(msg);
        }
Exemplo n.º 2
0
        private static void ParseSyncVarUpdate(NetworkMessage msg)
        {
            NetworkMessage.SyncVarUpdateMessage updateMsg = (NetworkMessage.SyncVarUpdateMessage)msg;

            NetworkEntity entity = null;

            try {
                entity = objectRegistryCallback(updateMsg.objectId);
            }
            catch (EntityNotFoundException e) {
                Debug.LogWarning("Unable to update SyncVar of network entity with id " + updateMsg.objectId.id);
                return;
            }
            finally {
                entity.ReceiveSyncVarUpdate(updateMsg.name, updateMsg.value);
            }
        }