Rogue: Savage Rats, a retro-themed dungeon crawler
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.
 
 
rogue-savage-rats/src/mightypork/gamecore/util/math/timing/TaskRepeater.java

50 lines
775 B

package mightypork.gamecore.util.math.timing;
import mightypork.gamecore.gui.Enableable;
import mightypork.gamecore.util.math.timing.animation.AnimatorRewind;
import mightypork.gamecore.util.math.timing.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)
{
run();
super.nextCycle(anim);
}
@Override
public void setEnabled(boolean yes)
{
this.enabled = yes;
}
@Override
public boolean isEnabled()
{
return enabled;
}
@Override
public void update(double delta)
{
if (!enabled) return;
super.update(delta);
}
}