Package edu.ntnu.idi.idatt.model.player
Class Player
java.lang.Object
edu.ntnu.idi.idatt.model.player.Player
- Direct Known Subclasses:
LadderGamePlayer
,LudoPlayer
Player class
This class represents a player in the game. It contains a name, a color, a player token type, and the current tile of the player.
-
Constructor Summary
ConstructorsConstructorDescriptionPlayer
(String name, String colorHex, PlayerTokenType playerTokenType, boolean isBot) Constructor for Player class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the color of the player in hex format.getName()
Returns the name of the player.Returns the type of player token to use for the player.boolean
isBot()
Returns whether the player is a bot or not.void
setBot
(boolean isBot) Sets whether the player is a bot or not.void
setColorHex
(String colorHex) Sets the color of the player in hex format.void
Sets the name of the player.void
setPlayerTokenType
(PlayerTokenType playerTokenType) Sets the type of player token to use for the player.
-
Constructor Details
-
Player
Constructor for Player class.- Parameters:
name
- The name of the player.colorHex
- The color of the player in hex format.playerTokenType
- The type of player token to use for the player.isBot
- Whether the player is a bot or not.
-
-
Method Details
-
getName
Returns the name of the player.- Returns:
- The name of the player.
-
getColorHex
Returns the color of the player in hex format.- Returns:
- The color of the player in hex format.
-
getPlayerTokenType
Returns the type of player token to use for the player.- Returns:
- the type of player token to use for the player
-
isBot
public boolean isBot()Returns whether the player is a bot or not.- Returns:
- true if the player is a bot, false otherwise.
-
setName
Sets the name of the player.- Parameters:
name
- The name to set.
-
setColorHex
Sets the color of the player in hex format.- Parameters:
colorHex
- The color to set.
-
setPlayerTokenType
Sets the type of player token to use for the player.- Parameters:
playerTokenType
- the type of player token to use for the player
-
setBot
public void setBot(boolean isBot) Sets whether the player is a bot or not.- Parameters:
isBot
- Whether the player is a bot or not.
-