Добавить общую систему весовых объектов

This commit is contained in:
2026-08-19 07:40:11 +03:00
parent 19bb64edfb
commit 259fcd316b
32 changed files with 1017 additions and 34 deletions
@@ -10,6 +10,7 @@ public final class LevelDefinition {
SPIKES, SAW, FREEZER, ELECTRIC, PIT, CRUSHER, FIRE, PROJECTILE, EXPLOSION
}
public enum SwitchType { PRESSURE, TOGGLE, TIMED }
public enum PhysicalObjectType { BOX, ROCK, BALL, ICE_BLOCK, COUNTERWEIGHT }
public static final class Box {
public final float x;
@@ -115,6 +116,18 @@ public final class LevelDefinition {
}
}
public static final class PhysicalObject {
public final PhysicalObjectType type;
public final Box box;
public final int mass;
public PhysicalObject(PhysicalObjectType type, Box box, int mass) {
this.type = type;
this.box = box;
this.mass = mass;
}
}
public final int number;
public final int formatVersion;
public final int physicsVersion;
@@ -129,6 +142,7 @@ public final class LevelDefinition {
public final Box goal;
public final int targetDeaths;
public final int targetSeconds;
public final List<PhysicalObject> objects;
public final List<Platform> platforms;
public final List<Hazard> hazards;
public final List<Switch> switches;
@@ -151,7 +165,7 @@ public final class LevelDefinition {
) {
this(1, 1, number, title, hint, title, hint, worldWidth, 1080f,
spawnX, spawnY, goal, targetDeaths, targetSeconds,
platforms, hazards, switches, doors);
Collections.emptyList(), platforms, hazards, switches, doors);
}
public LevelDefinition(
@@ -173,6 +187,32 @@ public final class LevelDefinition {
List<Hazard> hazards,
List<Switch> switches,
List<Door> doors
) {
this(formatVersion, physicsVersion, number, title, hint, titleRu, hintRu,
worldWidth, worldHeight, spawnX, spawnY, goal, targetDeaths,
targetSeconds, Collections.emptyList(), platforms, hazards, switches, doors);
}
public LevelDefinition(
int formatVersion,
int physicsVersion,
int number,
String title,
String hint,
String titleRu,
String hintRu,
float worldWidth,
float worldHeight,
float spawnX,
float spawnY,
Box goal,
int targetDeaths,
int targetSeconds,
List<PhysicalObject> objects,
List<Platform> platforms,
List<Hazard> hazards,
List<Switch> switches,
List<Door> doors
) {
this.formatVersion = formatVersion;
this.physicsVersion = physicsVersion;
@@ -188,6 +228,7 @@ public final class LevelDefinition {
this.goal = goal;
this.targetDeaths = targetDeaths;
this.targetSeconds = targetSeconds;
this.objects = Collections.unmodifiableList(objects);
this.platforms = Collections.unmodifiableList(platforms);
this.hazards = Collections.unmodifiableList(hazards);
this.switches = Collections.unmodifiableList(switches);