Moved speeds to LevelManager
This commit is contained in:
@ -3,6 +3,34 @@ package se.urmo.game.state;
|
||||
import lombok.Getter;
|
||||
|
||||
public class LevelManager {
|
||||
|
||||
@Getter
|
||||
private int level = 1;
|
||||
public enum Level {
|
||||
LEVEL1(1,6000, 0.75, 0.85, FruitType.CHERRY);
|
||||
|
||||
private final int frightendedDuration;
|
||||
private final double ghostSpeed;
|
||||
private final double pacmanSpeed;
|
||||
private final FruitType fruitType;
|
||||
private final int level;
|
||||
|
||||
Level(int level, int frightendedDuration, double ghostSpeed, double pacmanSpeed, FruitType fruitType) {
|
||||
this.level = level;
|
||||
this.frightendedDuration = frightendedDuration;
|
||||
this.ghostSpeed = ghostSpeed;
|
||||
this.pacmanSpeed = pacmanSpeed;
|
||||
this.fruitType = fruitType;
|
||||
}
|
||||
public static Level forLevel(int i) {
|
||||
return Level.values()[i];
|
||||
}
|
||||
}
|
||||
@Getter
|
||||
private Level currentLevel = Level.LEVEL1;
|
||||
public double getPacmanLevelSpeed() {
|
||||
return currentLevel.pacmanSpeed;
|
||||
}
|
||||
public double getGhostSpeed() {
|
||||
return currentLevel.ghostSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user