Entity constructor
Entity({
- Iterable<
Component> ? children, - int? priority,
- Iterable<
Behavior< ? behaviors,EntityMixin> >
The entity is the building block of a game. It represents a game object
that can hold multiple Behavior
s, which in turn define how the
entity behaves.
The visualization of the entity is defined by the Component
s that are
attached to it.
Implementation
Entity({
super.children,
super.priority,
Iterable<Behavior>? behaviors,
}) : assert(
children?.whereType<Behavior>().isEmpty ?? true,
'Behaviors cannot be added to as a child directly.',
) {
if (behaviors != null) {
addAll(behaviors);
}
}