void assertHasNotComponentA(Entity e) {
     var components = e.GetComponents();
     components.Length.should_be(0);
     var indices = e.GetComponentIndices();
     indices.Length.should_be(0);
     e.HasComponentA().should_be_false();
     e.HasComponents(_indicesA).should_be_false();
     e.HasAnyComponent(_indicesA).should_be_false();
 }
    void assertHasComponentA(Entity e, IComponent component = null) {
        if (component == null) {
            component = Component.A;
        }

        e.GetComponentA().should_be_same(component);
        var components = e.GetComponents();
        components.Length.should_be(1);
        components.should_contain(component);
        var indices = e.GetComponentIndices();
        indices.Length.should_be(1);
        indices.should_contain(CID.ComponentA);
        e.HasComponentA().should_be_true();
        e.HasComponents(_indicesA).should_be_true();
        e.HasAnyComponent(_indicesA).should_be_true();
    }
Example #3
0
 public bool Matches(Entity entity)
 {
     return (_allOfIndices == null || entity.HasComponents(_allOfIndices))
         && (_anyOfIndices == null || entity.HasAnyComponent(_anyOfIndices))
         && (_noneOfIndices == null || !entity.HasAnyComponent(_noneOfIndices));
 }
Example #4
0
 public bool Matches(Entity entity) {
     var matchesAllOf = _allOfIndices == null || entity.HasComponents(_allOfIndices);
     var matchesAnyOf = _anyOfIndices == null || entity.HasAnyComponent(_anyOfIndices);
     var matchesNoneOf = _noneOfIndices == null || !entity.HasAnyComponent(_noneOfIndices);
     return matchesAllOf && matchesAnyOf && matchesNoneOf;
 }