public override void Serialize(NetworkWriter writer) { writer.Write(id); writer.Write((int)type); if (type.IsFlagSet(UpdateType.Color)) { writer.Write(color); } if (type.IsFlagSet(UpdateType.Position)) { writer.Write(position); } if (type.IsFlagSet(UpdateType.Rotation)) { writer.Write(rotation); } if (type.IsFlagSet(UpdateType.Scale)) { writer.Write(scale); } }
public override void Deserialize(NetworkReader reader) { id = reader.ReadInt64(); type = (UpdateType)reader.ReadInt32(); if (type.IsFlagSet(UpdateType.Color)) { color = reader.ReadColor(); } if (type.IsFlagSet(UpdateType.Position)) { position = reader.ReadVector3(); } if (type.IsFlagSet(UpdateType.Rotation)) { rotation = reader.ReadQuaternion(); } if (type.IsFlagSet(UpdateType.Scale)) { scale = reader.ReadVector3(); } }