Добавить испытания и прогрессию по LevelID
This commit is contained in:
@@ -131,6 +131,8 @@ public final class LevelDefinition {
|
||||
public final int number;
|
||||
public final int formatVersion;
|
||||
public final int physicsVersion;
|
||||
public final String levelId;
|
||||
public final String worldId;
|
||||
public final String title;
|
||||
public final String hint;
|
||||
public final String titleRu;
|
||||
@@ -142,6 +144,7 @@ public final class LevelDefinition {
|
||||
public final Box goal;
|
||||
public final int targetDeaths;
|
||||
public final int targetSeconds;
|
||||
public final Box collectible;
|
||||
public final List<PhysicalObject> objects;
|
||||
public final List<Platform> platforms;
|
||||
public final List<Hazard> hazards;
|
||||
@@ -213,9 +216,41 @@ public final class LevelDefinition {
|
||||
List<Hazard> hazards,
|
||||
List<Switch> switches,
|
||||
List<Door> doors
|
||||
) {
|
||||
this(formatVersion, physicsVersion, defaultLevelId(number), "legacy",
|
||||
number, title, hint, titleRu, hintRu, worldWidth, worldHeight,
|
||||
spawnX, spawnY, goal, targetDeaths, targetSeconds, null, objects,
|
||||
platforms, hazards, switches, doors);
|
||||
}
|
||||
|
||||
public LevelDefinition(
|
||||
int formatVersion,
|
||||
int physicsVersion,
|
||||
String levelId,
|
||||
String worldId,
|
||||
int number,
|
||||
String title,
|
||||
String hint,
|
||||
String titleRu,
|
||||
String hintRu,
|
||||
float worldWidth,
|
||||
float worldHeight,
|
||||
float spawnX,
|
||||
float spawnY,
|
||||
Box goal,
|
||||
int targetDeaths,
|
||||
int targetSeconds,
|
||||
Box collectible,
|
||||
List<PhysicalObject> objects,
|
||||
List<Platform> platforms,
|
||||
List<Hazard> hazards,
|
||||
List<Switch> switches,
|
||||
List<Door> doors
|
||||
) {
|
||||
this.formatVersion = formatVersion;
|
||||
this.physicsVersion = physicsVersion;
|
||||
this.levelId = levelId;
|
||||
this.worldId = worldId;
|
||||
this.number = number;
|
||||
this.title = title;
|
||||
this.hint = hint;
|
||||
@@ -228,6 +263,7 @@ public final class LevelDefinition {
|
||||
this.goal = goal;
|
||||
this.targetDeaths = targetDeaths;
|
||||
this.targetSeconds = targetSeconds;
|
||||
this.collectible = collectible;
|
||||
this.objects = Collections.unmodifiableList(objects);
|
||||
this.platforms = Collections.unmodifiableList(platforms);
|
||||
this.hazards = Collections.unmodifiableList(hazards);
|
||||
@@ -235,6 +271,10 @@ public final class LevelDefinition {
|
||||
this.doors = Collections.unmodifiableList(doors);
|
||||
}
|
||||
|
||||
public static String defaultLevelId(int number) {
|
||||
return "legacy.level-" + (number < 10 ? "0" : "") + number;
|
||||
}
|
||||
|
||||
public boolean containsMechanic(HazardType type) {
|
||||
for (Hazard hazard : hazards) {
|
||||
if (hazard.type == type) return true;
|
||||
|
||||
Reference in New Issue
Block a user