Skip to content
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

Is it possible to extend family? #267

Open
xahon opened this issue Aug 22, 2018 · 2 comments
Open

Is it possible to extend family? #267

xahon opened this issue Aug 22, 2018 · 2 comments

Comments

@xahon
Copy link

xahon commented Aug 22, 2018

I have these families:

val Placeable: Family = Family.all(
            NavigationComponent.Position::class.java,
            NavigationComponent.Rotation::class.java
).get()

val Movable: Family = Family.all(
            NavigationComponent.Position::class.java,
            NavigationComponent.Rotation::class.java,
            MovementComponent.MoveSpeed::class.java,
            MovementComponent.MoveInfo::class.java
).get()

is there any way to make Movable something like this?

val Movable: Family = Family.all(
            *Placeable.components,
            MovementComponent.MoveSpeed::class.java,
            MovementComponent.MoveInfo::class.java
).get()
@metaphore
Copy link
Contributor

I think this should be fairly easy to implement method that can merge a family into another instance.

@xahon
Copy link
Author

xahon commented Aug 24, 2018

@metaphore I have to create family wrapper class that makes that because you can't access to types you pass into all, one and exclude

UPD
I found that approach as ugly workaround to create wrapper class because in my case it returns Family class from which you can't build a new one for, e.g. Engine.getEntitiesFor because all, one, exclude are private fields
So I may be will have to create a bunch of narrow-case families for each particular system

fabiitch added a commit to fabiitch/ashley that referenced this issue Jan 2, 2022
fabiitch added a commit to fabiitch/ashley that referenced this issue Jan 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants