internal void ReceiveMessage(SocketEndpoint sendingEndpoint, BinaryReader reader) { ShortID typeID = reader.ReadShortID(); if (typeID == SynchronizedSceneChangeTypeGlobalShaderProperty) { ReadGlobalShaderProperties(reader); } else { if (shouldClearScene) { ClearScene(); shouldClearScene = false; } IComponentBroadcasterService componentService; if (componentBroadcasterServices.TryGetValue(typeID, out componentService)) { short id = reader.ReadInt16(); ComponentBroadcasterChangeType changeType = (ComponentBroadcasterChangeType)reader.ReadByte(); switch (changeType) { case ComponentBroadcasterChangeType.Created: { GameObject mirror = GetOrCreateMirror(id); componentService.Create(mirror); } break; case ComponentBroadcasterChangeType.Updated: { GameObject mirror = GetOrCreateMirror(id); componentService.Read(sendingEndpoint, reader, mirror); } break; case ComponentBroadcasterChangeType.Destroyed: { GameObject mirror = FindGameObjectWithId(id); if (mirror != null) { componentService.Destroy(mirror); } } break; } } } }
public bool TryDeserializeTexture(BinaryReader reader, out Texture texture) { ShortID shortID = new ShortID(reader.ReadUInt16()); IAssetSerializer <Texture> textureSerializer; if (textureSerializers.TryGetValue(shortID, out textureSerializer)) { texture = textureSerializer.Deserialize(reader); return(true); } else { texture = null; return(false); } }
internal void LerpReceiveMessage(BinaryReader reader, float lerpVal) { ShortID typeID = reader.ReadShortID(); IComponentBroadcasterService componentService; if (componentBroadcasterServices.TryGetValue(typeID, out componentService)) { short id = reader.ReadInt16(); ComponentBroadcasterChangeType changeType = (ComponentBroadcasterChangeType)reader.ReadByte(); if (changeType == ComponentBroadcasterChangeType.Updated) { GameObject mirror; if (objectMirrors.TryGetValue(id, out mirror)) { componentService.LerpRead(reader, mirror, lerpVal); } } } }