-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Matcher
A matcher is a way to describe what kind of entites we are interested in.
They can be used to create Groups and Collectors
Which in turn can be used as Filters in Reactive Systems for example
Matcher are a small query language. GameMatcher
means that we have a Game
context and we can access all component types associated to this context. If we would write context.GetGroup(GameMatcher.Position);
We would get a group of entites which have Position
component. In order to define more complex groups, we can use AllOf
, AnyOf
and NoneOf
methods. AllOf
means that all the listed components has to be present on the entity in order for this entity to become part of the group. AnyOf
means that one of the listed component has to be present. And in case of NoneOf
we don't want the listed components to be present. NoneOf
is not a stand alone description, meaning that you will not be able to write context.GetGroup(GameMatcher.NoneOf(GameMatcher.Position));
It is prohibited because it creates a very large set. NoneOf
can be used only in combination with AllOf
or AnyOf
.
context.GetGroup(GameMatcher.AllOf(GameMatcher.Position, GameMatcher.Velocity).NoneOf(GameMatcher.NotMovable));
(adopted from EntitasCookbook/Groups )
Guides: Introduction - Installation - Upgrading - FAQ - Cookbook - Contributing
Need Help? Ask a question on Discord or create an issue.
- The Basics
- Concepts
- Architecture / Patterns