mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 11:43:19 +08:00
Extract shared children logic when handling components to ComponentSet (#859)
This commit is contained in:
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user