DurationMonitor class

Monitors whether the decorated node has returned the specified parameter Status since the DurationMonitor instance was updated.

The DurationMonitor will return Status.success when the decorated Node instance returns Status.success and the specified millisecond interval of time has elapsed.

If the DurationMonitor instance millisecond interval expires before the decorated Node instance returns the desired Status, the monitor timer is reset.

This is useful if you want to ensure that the child Node returns a specific Status over time. The granularity of the checks if user decided by calling the update() method as often as desired:

  • Call it every frame
  • Call it within a desired millisecond time frame
Inheritance

Constructors

DurationMonitor(Node node, {required int interval, required Status expecting, Status waiting = Status.running})
Creates a duration monitor for the specified argument Node instance.

Properties

elapsed int
Millisecond count since the last call to the update() method.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh() → void
Resets the elapsed time of the DurationMonitor instance to 0.
reset() → void
inherited
toString() String
A string representation of this object.
inherited
update() Status
override

Operators

operator ==(Object other) bool
The equality operator.
inherited