CameraFollowSystem class
ECS system that drives the camera based on entities carrying a CameraFollowComponent.
Single-target mode
When exactly one enabled entity has the lowest CameraFollowComponent.priority value, the system follows that entity using LookaheadBehavior (or plain spring follow when no VelocityComponent is present).
Multi-target mode
When two or more entities share the same lowest priority, the system switches to a MultiTargetBehavior that auto-zooms to keep all targets in view.
Setup
world.addSystem(CameraFollowSystem(cameraSystem: engine.cameraSystem));
world.addComponent(player, CameraFollowComponent());
Constructors
- CameraFollowSystem({required CameraSystem cameraSystem})
Properties
- cameraSystem → CameraSystem
-
final
-
entities
→ Iterable<
Entity> -
Get all entities that match this system's requirements
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isActive ↔ bool
-
Whether this system is active
getter/setter pairinherited
- priority ↔ int
-
Priority for system execution order (higher = earlier)
getter/setter pairinherited-setteroverride-getter
-
requiredComponents
→ List<
Type> -
Required component types for this system
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- world ↔ World
-
World this system belongs to
getter/setter pairinherited
Methods
-
dispose(
) → void -
Dispose system resources
inherited
-
forEach(
void action(Entity entity)) → void -
Execute a function for each matching entity
inherited
-
initialize(
) → void -
Initialize the system
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onAddedToWorld(
) → void -
Called when system is added to world
inherited
-
onRemovedFromWorld(
) → void -
Called when system is removed from world
inherited
-
render(
Canvas canvas, Size size) → void -
Render the system (optional)
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
double deltaTime) → void -
Update the system
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited