Timed Activatable
A Timed Activatable
is a controller that activates and deactivates another IActivatable
using timer functionality. A Timed Activatable
is an IActivatable
and an ITimerListener
.
Relationships
ITimedActivatable
ITimedActivatable
extends IActivatable
and ITimerListener
. An ITimedActivatable
controls an activatable
's activation and deactivation. Examples of Activatables
that are well-suited to be contained within a Timed Entity include Goals
, Tracks
, or even other Timed Activatables
.
When a Timed Activatable is activated, it activates its child Activatable
and subscribes to the ITimerService
for a specified duration. When the duration is over, it deactivates its child Activatable
and unsubscribes from the ITimerService
. A Timed Entity essentially controls an Activatable so that it is only available for a certain period of time.
Note
To create a Timed Activatable, you must provide data for an Activatable and TimedActivatableData, which contains the id of the Activatable. For example, to create a Timed Goal, you must provide data for a Goal and a TimedActivatableData which contains the goal's id.
Warning
The Activatable contained within a Timed Activatable should only be manipulated by the Timed Activatable. This avoids any unexpected changes to its saved data. For example, if a Goal was manipulated by a Timed Activatable and a Goal Track.
ITimedTrack
ITimedTrack
is an ITimedActivatable
whose Activatable is an ITrack
. ITimedTrack
allows for the collection of unclaimed rewards once the TimedTrack's duration is over. The concrete TimedGoalTrack
and TimedMilestoneTrack
implementations determine the rewards that can be claimed.