diff options
Diffstat (limited to 'src/main/java/fr/umlv/java/wallj/context/Stage.java')
-rw-r--r-- | src/main/java/fr/umlv/java/wallj/context/Stage.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/fr/umlv/java/wallj/context/Stage.java b/src/main/java/fr/umlv/java/wallj/context/Stage.java index 49aa196..9737583 100644 --- a/src/main/java/fr/umlv/java/wallj/context/Stage.java +++ b/src/main/java/fr/umlv/java/wallj/context/Stage.java | |||
@@ -17,6 +17,7 @@ import java.util.*; | |||
17 | * @author Pacien TRAN-GIRARD | 17 | * @author Pacien TRAN-GIRARD |
18 | */ | 18 | */ |
19 | public class Stage implements Updateable { | 19 | public class Stage implements Updateable { |
20 | public static final int BOMB_PLACEMENTS = 3; | ||
20 | private static final int VELOCITY_TICK_PER_MS = 6; | 21 | private static final int VELOCITY_TICK_PER_MS = 6; |
21 | private static final int POSITION_TICK_PER_MS = 2; | 22 | private static final int POSITION_TICK_PER_MS = 2; |
22 | 23 | ||
@@ -60,7 +61,17 @@ public class Stage implements Updateable { | |||
60 | * @implNote TODO: profile this and consider a garbage block counter | 61 | * @implNote TODO: profile this and consider a garbage block counter |
61 | */ | 62 | */ |
62 | public boolean isCleared() { | 63 | public boolean isCleared() { |
63 | return blocks.stream().noneMatch(block -> block.getType() == BlockType.GARBAGE); | 64 | return blocks.stream() |
65 | .noneMatch(block -> block.getType() == BlockType.GARBAGE); | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * @return T(the physics simulation can start, i.e. the player has placed all their bombs) | ||
70 | */ | ||
71 | public boolean isReady() { | ||
72 | return blocks.stream() | ||
73 | .filter(block -> block.getType() == BlockType.BOMB) | ||
74 | .count() == BOMB_PLACEMENTS; | ||
64 | } | 75 | } |
65 | 76 | ||
66 | /** | 77 | /** |