Extract shared children logic when handling components to ComponentSet (#859)

This commit is contained in:
Luan Nico
2021-07-04 02:44:15 -04:00
committed by GitHub
parent 235b080768
commit f818310e5b
19 changed files with 279 additions and 157 deletions

View File

@ -9,7 +9,7 @@ class Square extends PositionComponent {
}
}
class ParentSquare extends Square {
class ParentSquare extends Square with HasGameRef {
ParentSquare(Vector2 position, Vector2 size) : super(position, size);
@override
@ -27,7 +27,7 @@ class ParentSquare extends Square {
Square(Vector2(70, 200), Vector2(50, 50), angle: 5),
];
children.forEach(addChild);
children.forEach((c) => addChild(c, gameRef: gameRef));
}
}