Class GameDetails
java.lang.Object
model.GameDetails
- All Implemented Interfaces:
Serializable
The details for one game, including the user playing, the game settings the scoring (shots fired, ships destroyed, score and previous high score)
Company: TAFE SA
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleanintintgetScore()intintbooleanvoidloadData()final voidvoidsaveData()voidsetGameSettings(GameSettings gameSettings) voidsetHighScore(int score) voidsetNewHighScore(boolean newHighScore) voidsetScore(int score) voidsetShipsDestroyed(int ships) voidsetShotsFired(int shots) voidsetUserDetails(UserDetails userDetails) toString()
-
Field Details
-
POINTS_GAINED_FOR_SHIP_DESTROYED
public static final int POINTS_GAINED_FOR_SHIP_DESTROYED- See Also:
-
POINTS_LOST_FOR_WASTED_SHOT
public static final int POINTS_LOST_FOR_WASTED_SHOT- See Also:
-
-
Constructor Details
-
GameDetails
-
GameDetails
- Parameters:
user- an instance of the UserDetails objectgameSettings- an instance of the GameSettings object- Throws:
Exception
-
-
Method Details
-
setUserDetails
- Parameters:
userDetails- an instance of UserDetails
-
setGameSettings
- Parameters:
gameSettings- an instance of GameSettings
-
getGameSettings
- Returns:
- the gameSettings class
-
getUserDetails
- Returns:
- the UserDetails class
-
setHighScore
public void setHighScore(int score) - Parameters:
score- the value of the high score
-
getHighScore
public int getHighScore()- Returns:
- the value of the high score
-
setScore
public void setScore(int score) - Parameters:
score- the score that you want to set
-
getScore
public int getScore()- Returns:
- the score of the user
-
setShipsDestroyed
public void setShipsDestroyed(int ships) - Parameters:
ships- the number of ships that have been destroyed
-
getShipsDestroyed
public int getShipsDestroyed()- Returns:
- the number of ships that have been destroyed
-
setShotsFired
public void setShotsFired(int shots) - Parameters:
shots- sets the number of shots that the user has fired
-
getShotsFired
public int getShotsFired()- Returns:
- the number of shots fired
-
isNewHighScore
public boolean isNewHighScore()- Returns:
- true or false if a score is a new high score
-
setNewHighScore
public void setNewHighScore(boolean newHighScore) - Parameters:
newHighScore- if a new high score has been hit set to true otherwise false
-
toString
-
equals
-
calculateScoreChanges
public int calculateScoreChanges()- Returns:
- the current score
-
resetTheScoringDetails
-
saveData
-
loadData
-