From 3ca01ae39eaadf210777ea187946366a6b657351 Mon Sep 17 00:00:00 2001 From: Adam NAILI Date: Sun, 14 Jan 2018 15:23:54 +0100 Subject: Implementing 'isOver' feature in Game --- src/main/java/fr/umlv/java/wallj/context/Game.java | 11 +++++++++++ src/main/java/fr/umlv/java/wallj/context/InputHandler.java | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/main') 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 { private final List controllers; private int indexBoard; private final List boards; + private boolean over; /** * @param boards the list of boards charged for the game @@ -32,6 +33,7 @@ public final class Game { this.boards = Collections.unmodifiableList(boards); this.indexBoard = 0; this.currentStage = new Stage(this.boards.get(0)); + this.over = false; } /** @@ -59,6 +61,13 @@ public final class Game { return currentStage; } + public boolean isOver() { + return over; + } + public void setOver(){ + over = true; + } + public void nextStage() { if (hasNextBoard()) { currentStage = new Stage(nextBoard()); @@ -81,4 +90,6 @@ public final class Game { events.addAll(currentStage.update(context)); return events; } + + } 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 { /** * @return the list of events converted from Zen 5 events to game events */ - List getEvents() { + public List getEvents() { LinkedList events = new LinkedList<>(); fr.umlv.zen5.Event event = applicationContext.pollEvent(); if (event != null) { -- cgit v1.2.3