public void AllAnyFilterTest() { List <IEcsEntity> entities = new List <IEcsEntity> { _entityABD }; IEcsGroup group = _world.Filter(new EcsFilter().AllOf <ComponentB, ComponentB, ComponentD>().AnyOf <ComponentA>()); Assert.AreEqual(entities.Count, group.CalculateCount()); group.ForEach(entity => { Assert.IsTrue(entities.Contains(entity)); }); entities = new List <IEcsEntity> { _entityABD, _entityBD0, _entityBD1 }; group = _world.Filter(new EcsFilter().AllOf <ComponentD, ComponentD>().AnyOf <ComponentB, ComponentC, ComponentC>()); Assert.AreEqual(entities.Count, group.CalculateCount()); group.ForEach(entity => { Assert.IsTrue(entities.Contains(entity)); }); }
public void AllFilterTest() { List <IEcsEntity> entities = new List <IEcsEntity> { _entityABD, _entityBD0, _entityBD1, _entityBC, _entityAB }; IEcsGroup group = _world.Filter(new EcsFilter().AllOf <ComponentB>()); Assert.AreEqual(entities.Count, group.CalculateCount()); group.ForEach((IEcsEntity entity, ComponentB compB) => { Assert.IsTrue(entities.Contains(entity)); }); entities = new List <IEcsEntity> { _entityABD, _entityBD0, _entityBD1 }; group = _world.Filter(new EcsFilter().AllOf <ComponentB, ComponentD>()); Assert.AreEqual(3, group.CalculateCount()); group.ForEach((IEcsEntity entity, ComponentB compB, ComponentD compD) => { Assert.IsTrue(entities.Contains(entity)); }); }
public void NoneFilterTest() { List <IEcsEntity> entities = new List <IEcsEntity> { _entityAC }; IEcsGroup group = _world.Filter(new EcsFilter().NoneOf <ComponentB, ComponentD>()); Assert.AreEqual(entities.Count, group.CalculateCount()); group.ForEach(entity => { Assert.IsTrue(entities.Contains(entity)); }); group = _world.Filter(new EcsFilter().NoneOf <ComponentB, ComponentD, ComponentB>()); Assert.AreEqual(entities.Count, group.CalculateCount()); group.ForEach(entity => { Assert.IsTrue(entities.Contains(entity)); }); }