Files
PacMan/src/main/java/se/urmo/game/state/LevelManager.java
2025-09-01 15:29:25 +02:00

59 lines
2.1 KiB
Java

package se.urmo.game.state;
import lombok.Getter;
public class LevelManager {
public void nextLevel() {
currentLevel = Level.forLevel(currentLevel.getLevel() + 1);
}
@Getter
public enum Level {
LEVEL1(1,6000, 0.75, 0.8, FruitType.CHERRY),
LEVEL2(2,3000, 0.85, 0.85, FruitType.CHERRY),
LEVEL3(3,1000, 0.95, 0.9, FruitType.CHERRY),
LEVEL4(4,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL5(5,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL6(6,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL7(7,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL8(8,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL9(9,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL10(10,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL11(11,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL12(12,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL13(13,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL14(14,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL15(15,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL16(16,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL17(17,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL18(18,6000, 0.75, 0.85, FruitType.CHERRY),
LEVEL19(19,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;
}
}