Collection of useful utilities for Java games and apps. A lot of interesting utilities that could maybe still find some use if you work with Java...
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.
mightyutils/src/mightypork/utils/math/timing/TaskRepeater.java

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();
}