RandomMovementApi class
API responsible for adding random movement behavior to a component.
The parent component must have a Movement mixin.
Constructors
- RandomMovementApi(Movement _comp)
Properties
- area ↔ ShapeHitbox?
-
Area where the random movement will be made.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → void - Releases all registered callbacks.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onStartMoveListener(
OnRandomMovementStartCallback callback) → void - Registers a callback fired when random movement starts.
-
onStopMoveListener(
OnRandomMovementStopCallback callback) → void - Registers a callback fired when random movement stops.
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
double dt, {double? speed, double maxDistance = 50, double minDistance = 25, int timeKeepStopped = 2000, bool updateAngle = false, bool checkDirectionWithRayCast = false, RandomMovementDirections directions = RandomMovementDirections.all}) → void - Executes random movement. Should be called inside the component's update method.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited