diff options
author | Adam NAILI | 2018-01-14 15:23:54 +0100 |
---|---|---|
committer | Adam NAILI | 2018-01-14 15:23:54 +0100 |
commit | 3ca01ae39eaadf210777ea187946366a6b657351 (patch) | |
tree | 08ec2866b71682b012df3d5bf681edc5bcb20edc /src/main | |
parent | b81db47a693f69f522ad0e31fd2354bed1d2ea00 (diff) | |
download | wallj-3ca01ae39eaadf210777ea187946366a6b657351.tar.gz |
Implementing 'isOver' feature in Game
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/fr/umlv/java/wallj/context/Game.java | 11 | ||||
-rw-r--r-- | src/main/java/fr/umlv/java/wallj/context/InputHandler.java | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/fr/umlv/java/wallj/context/Game.java b/src/main/java/fr/umlv/java/wallj/context/Game.java index c7dd6f1..900ee63 100644 --- a/src/main/java/fr/umlv/java/wallj/context/Game.java +++ b/src/main/java/fr/umlv/java/wallj/context/Game.java | |||
@@ -18,6 +18,7 @@ public final class Game { | |||
18 | private final List<Controller> controllers; | 18 | private final List<Controller> controllers; |
19 | private int indexBoard; | 19 | private int indexBoard; |
20 | private final List<Board> boards; | 20 | private final List<Board> boards; |
21 | private boolean over; | ||
21 | 22 | ||
22 | /** | 23 | /** |
23 | * @param boards the list of boards charged for the game | 24 | * @param boards the list of boards charged for the game |
@@ -32,6 +33,7 @@ public final class Game { | |||
32 | this.boards = Collections.unmodifiableList(boards); | 33 | this.boards = Collections.unmodifiableList(boards); |
33 | this.indexBoard = 0; | 34 | this.indexBoard = 0; |
34 | this.currentStage = new Stage(this.boards.get(0)); | 35 | this.currentStage = new Stage(this.boards.get(0)); |
36 | this.over = false; | ||
35 | } | 37 | } |
36 | 38 | ||
37 | /** | 39 | /** |
@@ -59,6 +61,13 @@ public final class Game { | |||
59 | return currentStage; | 61 | return currentStage; |
60 | } | 62 | } |
61 | 63 | ||
64 | public boolean isOver() { | ||
65 | return over; | ||
66 | } | ||
67 | public void setOver(){ | ||
68 | over = true; | ||
69 | } | ||
70 | |||
62 | public void nextStage() { | 71 | public void nextStage() { |
63 | if (hasNextBoard()) { | 72 | if (hasNextBoard()) { |
64 | currentStage = new Stage(nextBoard()); | 73 | currentStage = new Stage(nextBoard()); |
@@ -81,4 +90,6 @@ public final class Game { | |||
81 | events.addAll(currentStage.update(context)); | 90 | events.addAll(currentStage.update(context)); |
82 | return events; | 91 | return events; |
83 | } | 92 | } |
93 | |||
94 | |||
84 | } | 95 | } |
diff --git a/src/main/java/fr/umlv/java/wallj/context/InputHandler.java b/src/main/java/fr/umlv/java/wallj/context/InputHandler.java index 637e94f..1a64667 100644 --- a/src/main/java/fr/umlv/java/wallj/context/InputHandler.java +++ b/src/main/java/fr/umlv/java/wallj/context/InputHandler.java | |||
@@ -33,7 +33,7 @@ public final class InputHandler { | |||
33 | /** | 33 | /** |
34 | * @return the list of events converted from Zen 5 events to game events | 34 | * @return the list of events converted from Zen 5 events to game events |
35 | */ | 35 | */ |
36 | List<fr.umlv.java.wallj.event.Event> getEvents() { | 36 | public List<fr.umlv.java.wallj.event.Event> getEvents() { |
37 | LinkedList<fr.umlv.java.wallj.event.Event> events = new LinkedList<>(); | 37 | LinkedList<fr.umlv.java.wallj.event.Event> events = new LinkedList<>(); |
38 | fr.umlv.zen5.Event event = applicationContext.pollEvent(); | 38 | fr.umlv.zen5.Event event = applicationContext.pollEvent(); |
39 | if (event != null) { | 39 | if (event != null) { |