public void SendUpdate(BlittableComponent.Update update) { var component = EntityManager.GetComponentData <BlittableComponent.Component>(Entity); if (update.BoolField.HasValue) { component.BoolField = update.BoolField.Value; } if (update.IntField.HasValue) { component.IntField = update.IntField.Value; } if (update.LongField.HasValue) { component.LongField = update.LongField.Value; } if (update.FloatField.HasValue) { component.FloatField = update.FloatField.Value; } if (update.DoubleField.HasValue) { component.DoubleField = update.DoubleField.Value; } EntityManager.SetComponentData(Entity, component); }
public void ComponentUpdated_gets_triggered_when_the_reader_receives_an_update() { var componentUpdated = false; var updateToQueue = new BlittableComponent.Update(); ReaderPublic.ComponentUpdated += update => { Assert.AreEqual(updateToQueue, update); componentUpdated = true; }; Assert.IsFalse(componentUpdated, "Adding an event callback should not fire it immediately"); ReaderWriterInternal.OnComponentUpdate(new BlittableComponent.Update()); Assert.IsTrue(componentUpdated); }