You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
696 B
44 lines
696 B
package mightypork.utils.math.timing;
|
|
|
|
|
|
import mightypork.utils.interfaces.Enableable;
|
|
import mightypork.utils.math.animation.AnimatorRewind;
|
|
import mightypork.utils.math.animation.NumAnimated;
|
|
|
|
|
|
public abstract class TaskRepeater extends AnimatorRewind implements Runnable, Enableable {
|
|
|
|
private boolean enabled = true;
|
|
|
|
|
|
public TaskRepeater(double period) {
|
|
super(period);
|
|
}
|
|
|
|
|
|
@Override
|
|
protected void nextCycle(NumAnimated anim)
|
|
{
|
|
if (isEnabled()) run();
|
|
super.nextCycle(anim);
|
|
}
|
|
|
|
|
|
@Override
|
|
public void setEnabled(boolean yes)
|
|
{
|
|
this.enabled = yes;
|
|
}
|
|
|
|
|
|
@Override
|
|
public boolean isEnabled()
|
|
{
|
|
return enabled;
|
|
}
|
|
|
|
|
|
@Override
|
|
public abstract void run();
|
|
|
|
}
|
|
|