From 9f843b8db6ee83eb9734163dadfdbe91730e757c Mon Sep 17 00:00:00 2001 From: torlunjen Date: Thu, 9 Apr 2020 19:56:33 +0200 Subject: [PATCH] Update Robot.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Legger til felt for sjekk om en robot har besøkt et flagg i løpet av runden eller ikke. Co-Authored-By: gabrielmagnus --- .../inf112/fiasko/roborally/objects/Robot.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/inf112/fiasko/roborally/objects/Robot.java b/src/main/java/inf112/fiasko/roborally/objects/Robot.java index 16e1fac..4082beb 100644 --- a/src/main/java/inf112/fiasko/roborally/objects/Robot.java +++ b/src/main/java/inf112/fiasko/roborally/objects/Robot.java @@ -16,6 +16,7 @@ public class Robot { private Position backupPosition; private Position currentPosition; private Direction facingDirection; + private boolean hasTouchedFlagThisTurn = false; /** * Instantiates a new robot @@ -29,6 +30,23 @@ public class Robot { this.facingDirection = Direction.NORTH; } + /** + * True if the robot has touched a flag in the current turn + * @return a boolean + */ + public boolean isHasTouchedFlagThisTurn() { + return hasTouchedFlagThisTurn; + } + + /** + * Sets the boolean value to true if the robot touches a flag during a turn, + * and false at the end of each turn. + * @param hasTouchedFlagThisTurn the boolean value to be set. + */ + public void setHasTouchedFlagThisTurn(boolean hasTouchedFlagThisTurn) { + this.hasTouchedFlagThisTurn = hasTouchedFlagThisTurn; + } + /** * Gets the damage the robot has taken * @return The amount of damage the robot has received