public void DisableT_Should_disable_component_of_type_T_on_created_entity() { using EntityCommandRecorder recorder = new EntityCommandRecorder(1024); using World world = new World(); EntityRecord record = recorder.CreateEntity(); record.Set(true); record.Disable <bool>(); recorder.Execute(world); Check.That(world.GetAllEntities().Single().IsEnabled <bool>()).IsFalse(); }
public void Remove_Should_remove_component_on_created_entity() { using EntityCommandRecorder recorder = new EntityCommandRecorder(1024); using World world = new World(); EntityRecord record = recorder.CreateEntity(world); record.Set(true); record.Remove <bool>(); recorder.Execute(); Check.That(world.Single().Has <bool>()).IsFalse(); }
public void EnableT_Should_enable_component_of_type_T_on_created_entity() { using EntityCommandRecorder recorder = new(1024); using World world = new(); EntityRecord record = recorder.CreateEntity(world); record.Set(true); record.Disable <bool>(); record.Enable <bool>(); recorder.Execute(); Check.That(world.Single().IsEnabled()).IsTrue(); }
public void Set_Should_set_reference_component_on_created_entity() { object o = new(); using EntityCommandRecorder recorder = new(1024); using World world = new(); EntityRecord record = recorder.CreateEntity(world); record.Set(o); recorder.Execute(); Check.That(world.Single().Get <object>()).IsEqualTo(o); }
public void Set_Should_set_blittable_component_on_recorded_entity() { using EntityCommandRecorder recorder = new(1024); using World world = new(); Entity entity = world.CreateEntity(); EntityRecord record = recorder.Record(entity); record.Set <bool>(); recorder.Execute(); Check.That(entity.Get <bool>()).IsFalse(); }
public void Set_Should_set__reference_component_on_created_entity() { object o = new object(); using (EntityCommandRecorder recorder = new EntityCommandRecorder(1024)) using (World world = new World()) { EntityRecord record = recorder.CreateEntity(); record.Set(o); recorder.Execute(world); Check.That(world.GetAllEntities().Single().Get <object>()).IsEqualTo(o); } }
public void Set_Should_set__blittable_component_on_created_entity() { using (EntityCommandRecorder recorder = new EntityCommandRecorder(1024)) { using (World world = new World()) { EntityRecord record = recorder.CreateEntity(); record.Set(true); recorder.Execute(world); Check.That(world.GetAllEntities().Single().Get <bool>()).IsTrue(); } } }
public void Set_Should_set__blittable_component_on_recorded_entity() { using (EntityCommandRecorder recorder = new EntityCommandRecorder(1024)) using (World world = new World()) { Entity entity = world.CreateEntity(); EntityRecord record = recorder.Record(entity); record.Set(true); recorder.Execute(world); Check.That(entity.Get <bool>()).IsTrue(); } }
public void Set_Should_set_non_blittable_component_on_created_entity() { object o = new(); using EntityCommandRecorder recorder = new(1024); using World world = new(); EntityRecord record = recorder.CreateEntity(world); record.Set(new NonBlittable(42, o)); recorder.Execute(); Check.That(world.Single().Get <NonBlittable>().Id).IsEqualTo(42); Check.That(world.Single().Get <NonBlittable>().Item).IsEqualTo(o); }
public void NotifyChanged_Should_change_component_on_created_entity() { Entity result = default; using EntityCommandRecorder recorder = new(1024); using World world = new(); using IDisposable changed = world.SubscribeComponentChanged((in Entity e, in bool _, in bool _) => result = e); EntityRecord record = recorder.CreateEntity(world); record.Set(true); record.NotifyChanged <bool>(); recorder.Execute(); Check.That(result).IsEqualTo(world.Single()); }
public void Set_Should_set__reference_component_on_recorded_entity() { object o = new object(); using EntityCommandRecorder recorder = new EntityCommandRecorder(1024); using World world = new World(); Entity entity = world.CreateEntity(); EntityRecord record = recorder.Record(entity); record.Set(o); recorder.Execute(world); Check.That(entity.Get <object>()).IsEqualTo(o); }
public void Set_Should_set__non_blittable_component_on_recorded_entity() { object o = new object(); using (EntityCommandRecorder recorder = new EntityCommandRecorder(1024)) using (World world = new World()) { Entity entity = world.CreateEntity(); EntityRecord record = recorder.Record(entity); record.Set(new NonBlittable(42, o)); recorder.Execute(world); Check.That(entity.Get <NonBlittable>().Id).IsEqualTo(42); Check.That(entity.Get <NonBlittable>().Item).IsEqualTo(o); } }