stoped task at game end
This commit is contained in:
@@ -33,6 +33,7 @@ public class ColorJump extends StatelessGame {
|
|||||||
);
|
);
|
||||||
private Block currentBlock;
|
private Block currentBlock;
|
||||||
private double roundTime = 5;
|
private double roundTime = 5;
|
||||||
|
private final double multiplierNextRoundTime = 0.9;
|
||||||
|
|
||||||
public ColorJump() {
|
public ColorJump() {
|
||||||
super(Dimension.THE_END.key, "ColorJump", new LastWinsScore());
|
super(Dimension.THE_END.key, "ColorJump", new LastWinsScore());
|
||||||
@@ -67,16 +68,17 @@ public class ColorJump extends StatelessGame {
|
|||||||
TaskSchedule stop = TaskSchedule.stop();
|
TaskSchedule stop = TaskSchedule.stop();
|
||||||
|
|
||||||
scheduler.scheduleTask(() -> {
|
scheduler.scheduleTask(() -> {
|
||||||
|
if(!this.isRunning) return stop;
|
||||||
this.destroyAllExcept(this.currentBlock);
|
this.destroyAllExcept(this.currentBlock);
|
||||||
|
|
||||||
scheduler.scheduleTask(() -> {
|
scheduler.scheduleTask(() -> {
|
||||||
this.nextRound();
|
if(this.isRunning) this.nextRound();
|
||||||
return stop;
|
return stop;
|
||||||
}, TaskSchedule.seconds(3));
|
}, TaskSchedule.seconds(3));
|
||||||
return stop;
|
return stop;
|
||||||
}, TaskSchedule.seconds((long) this.roundTime));
|
}, TaskSchedule.seconds((long) this.roundTime));
|
||||||
if(this.roundTime > 0.5)
|
if(this.roundTime > 0.5)
|
||||||
this.roundTime = this.roundTime * 0.9;
|
this.roundTime = this.roundTime * this.multiplierNextRoundTime;
|
||||||
|
|
||||||
long secondsLeft = Math.max(0, (long) this.roundTime);
|
long secondsLeft = Math.max(0, (long) this.roundTime);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user