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
821 B
44 lines
821 B
package mightypork.rogue.world.entity;
|
|
|
|
|
|
import mightypork.utils.ion.IonBundled;
|
|
import mightypork.utils.ion.IonDataBundle;
|
|
import mightypork.utils.math.timing.TaskRepeater;
|
|
|
|
|
|
public abstract class AiTimer extends TaskRepeater implements IonBundled {
|
|
|
|
public AiTimer(double duration)
|
|
{
|
|
super(duration);
|
|
}
|
|
|
|
|
|
@Override
|
|
public abstract void run();
|
|
|
|
|
|
@Override
|
|
public void load(IonDataBundle bundle)
|
|
{
|
|
final boolean wasPaused = bundle.get("paused", isPaused());
|
|
if (wasPaused) {
|
|
pause();
|
|
} else {
|
|
resume();
|
|
}
|
|
|
|
setProgress(bundle.get("progress", getProgress()));
|
|
setDuration(bundle.get("duration", getDuration()));
|
|
}
|
|
|
|
|
|
@Override
|
|
public void save(IonDataBundle bundle)
|
|
{
|
|
bundle.put("paused", isPaused());
|
|
bundle.put("progress", getProgress());
|
|
bundle.put("duration", getDuration());
|
|
}
|
|
|
|
}
|
|
|