-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IReactiveSystem excecute based on component data? #165
Comments
You can create your system as usual, to react on
I didn't find perfect solution, so I do this all the time :) |
I've also thought of this option, just forgot to mention it. |
Basically, the question is: Matcher.Color().Where(e => e.color.value == 1); // not Linq where and use it as a trigger. This can also work for more complex matchers Matcher.AllOf(A, B, C).NoneOf(D).Where(e => ...); It's not implemented yet, but generally yes. A few things that pop to my mind:
But all in all, shouldn't really be reasons not to implement it. This might actually a pretty nice addition to Entitas. |
I've had this implemented maybe like a month ago but only for components with enums - if Simon decides that's enough you could get it soon :) |
It is possible to have a IReactiveSystem that executes not only based on the fact that some component has changed, but also Match the value inside one of them? (or is it the wrong way to design this?)
So, for example, I have a ColorComponent that stores a enum value of colors.
And I want to add a ReactiveSystem that only reacts to entities in which for example position changed (PositionComponent), but only those entities which ColorComponent has its color property equal to GREEN.
If it is impossible - should I make a system that reacts to all position changes (from entities that also have the ColorComponent)? But it also doesn't seem right.
It's just that instead of adding a new system that reacts to the specific color I would need to modify this system that reacts to all of them and calls some other class to handle the specific color. (And so I lose part of the promise that it is easy to add and remove features by adding/disabling systems.)
I guess I could make each color as a Component - like GreenComponent, etc. But this also doesn't seem right.
What is the way to go in this example?
The text was updated successfully, but these errors were encountered: