-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
AsMultiMap with selector #153
Comments
You can provide AsMultiMap with a IEqualityComparer to change what the multimap use for equality. You can also make your component implements |
Ah I think I saw that but didn't make the connection. In another section, I had read |
Ah yes this is for the AEntityMultiMapSystem so you can control in which order each keys are processed if it is needed. The overall documentation could use some more detail ^^" |
Ok, so I've been playing around with this a bit. It's still a little awkward using multimap this way because TKey is the component type, not the real key type. For the example above, if I create a multimap, in order to access a component by some parent entity I'd still have to create a Instead, it'd be nice to be able to do something like this: var map = world.GetEntities().With<TransformComponent>().AsMultiMap(t => t.Parent); which would mean my lookups could change // before:
var results = map[new TransformComponent { Entity = entity, Position = Vector3.Zero, Rotation = Quaternion.Identity }];
// after:
var results = map[entity]; |
Hum I guess it should be possible but we would need a new type |
It looks to me like
AsMultiMap
uses some component as a key to reference entities. Is there some way that I can specify a key selector instead of using an entire component?For example, lets say I have some component:
If I wanted to get the parent of some component, that's easy to do by following Parent. But if I wanted to find all children of an entity, how could I construct a query to efficiently perform that lookup? Is this even a viable approach?
The text was updated successfully, but these errors were encountered: