Closed alexandrunechita-popcore closed 1 year ago
H! You can already:
protected override ICollector<AppEntity> GetTrigger(IContext<AppEntity> context) => context.CreateCollector(
GameMatcher.Comp1.Added(),
GameMatcher.Comp2.Added()
);
Btw,
context.CreateCollector(GameMatcher.AllOf(GameMatcher.Comp1, GameMatcher.Comp2));
probably doesn't do what you expect.
(so far so good)
this is probably not what you intend.
The solution mentioned above will trigger the reactive system when comp1 or comp2 are added or replaced.
Btw,
context.CreateCollector(GameMatcher.AllOf(GameMatcher.Comp1, GameMatcher.Comp2));
probably doesn't do what you expect.
- add comp1 -> matcher doesn't match yet, entity not added to group
add comp2 -> matcher matches, entity is added to group
- collector will collect added entity
(so far so good)
replace either comp1 or comp2
- nothing will happen, because entity is already in group
this is probably not what you intend.
The solution mentioned above will trigger the reactive system when comp1 or comp2 are added or replaced.
I see. I expect GameMatcher.Comp1 to behave like GameMatcher.Comp1.CHANGED where any addition, removal or replacement qualifies are including the entity in List
Now:
context.CreateCollector( GameMatcher.AllOf( GameMatcher.Comp1, GameMatcher.Comp2 ) );
And it would be convenient to do:
context.CreateCollector( GameMatcher.Comp1, GameMatcher.Comp2 );
I think 5 or 6 parameters maximum would suffice.