diff options
Diffstat (limited to 'src/main/java/fr/umlv/java/wallj/context/Game.java')
-rw-r--r-- | src/main/java/fr/umlv/java/wallj/context/Game.java | 17 |
1 files changed, 8 insertions, 9 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 b78bae4..7d09b26 100644 --- a/src/main/java/fr/umlv/java/wallj/context/Game.java +++ b/src/main/java/fr/umlv/java/wallj/context/Game.java | |||
@@ -39,7 +39,7 @@ public final class Game implements Updateable { | |||
39 | /** | 39 | /** |
40 | * @return a boolean on the condition of having a next Board in our game. | 40 | * @return a boolean on the condition of having a next Board in our game. |
41 | */ | 41 | */ |
42 | public boolean hasNextBoard() { | 42 | private boolean hasNextBoard() { |
43 | return indexBoard + 1 < boards.size(); | 43 | return indexBoard + 1 < boards.size(); |
44 | } | 44 | } |
45 | 45 | ||
@@ -61,21 +61,20 @@ public final class Game implements Updateable { | |||
61 | return currentStage; | 61 | return currentStage; |
62 | } | 62 | } |
63 | 63 | ||
64 | /** | ||
65 | * @return the status of the game | ||
66 | */ | ||
64 | public boolean isOver() { | 67 | public boolean isOver() { |
65 | return over; | 68 | return over; |
66 | } | 69 | } |
67 | 70 | ||
68 | public void setOver() { | 71 | private void nextStage() { |
69 | over = true; | ||
70 | } | ||
71 | |||
72 | public void nextStage() { | ||
73 | if (hasNextBoard()) { | 72 | if (hasNextBoard()) { |
74 | currentStage = new Stage(nextBoard()); | 73 | currentStage = new Stage(nextBoard()); |
75 | } | 74 | } |
76 | } | 75 | } |
77 | 76 | ||
78 | public void retryStage() { | 77 | private void retryStage() { |
79 | currentStage = new Stage(currentStage.getBoard()); | 78 | currentStage = new Stage(currentStage.getBoard()); |
80 | } | 79 | } |
81 | 80 | ||
@@ -84,12 +83,12 @@ public final class Game implements Updateable { | |||
84 | nextStage(); | 83 | nextStage(); |
85 | return; | 84 | return; |
86 | } | 85 | } |
87 | setOver(); | 86 | over = true; |
88 | } | 87 | } |
89 | 88 | ||
90 | private void handleEvents(Context context) { | 89 | private void handleEvents(Context context) { |
91 | if (Events.findFirst(context.getEvents(), QuitGameOrder.class).isPresent()) { | 90 | if (Events.findFirst(context.getEvents(), QuitGameOrder.class).isPresent()) { |
92 | context.getGame().setOver(); | 91 | over = true; |
93 | return; | 92 | return; |
94 | } | 93 | } |
95 | if (Events.findFirst(context.getEvents(), ConfirmOrder.class).isPresent()) { | 94 | if (Events.findFirst(context.getEvents(), ConfirmOrder.class).isPresent()) { |