public class Player extends GameModelObservable implements IPlayer
Constructor and Description |
---|
Player(Client client,
Token token)
Constructor for a Player object containing an existing client object.
|
Player(Client client,
Token token,
GameModel gameModel)
Deprecated.
Setting the GameModel is done by the GameModel itself when a player is added. Do not pass a GameModel here.
Constructor for a Player object containing an existing client object.
Binds to the token passed and adds the gameModel as an observer.
|
Player(String name,
boolean isAI,
Token token,
int clientId)
Constructor for a Player object.
|
Player(String name,
boolean isAI,
Token token,
int clientId,
GameModel gameModel)
Deprecated.
Setting the GameModel is done by the GameModel itself when a player is added. Do not pass a GameModel here.
Constructor for a Player object. Binds to the token passed and adds the gameModel as an observer.
|
Modifier and Type | Method and Description |
---|---|
Client |
getClient() |
int |
getClientId() |
int |
getColorId() |
KickState |
getKickState() |
String |
getName() |
ArrayList<Tile> |
getTiles()
Please use getTilesIterator instead.
|
Iterator<Tile> |
getTilesIterator() |
Token |
getToken() |
boolean |
hasOnHand(int tileId) |
boolean |
hasOnHand(Tile tile)
Tells whether the tile passed is owned by this player and currently in the player's tile list.
|
boolean |
isAI() |
void |
removeTile(Tile tile)
Removes a Tile object from the players tile list and notifies the GameModel, passing this tile.
|
void |
setColorId(int id) |
void |
setKickState(KickState kickState) |
void |
setTileList(ArrayList<Tile> tileList)
Sets the tileList of this player.
|
addGameModelObservable, getGameModel, notifyGameModel, notifyGameModel, removeGameModelObservable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
public Player(Client client, Token token, GameModel gameModel)
client
- the Client object to be usedtoken
- the player's token objectgameModel
- the GameModel the player belongs topublic Player(Client client, Token token)
client
- the Client object to be usedtoken
- the player's token objectpublic Player(String name, boolean isAI, Token token, int clientId)
name
- the player's nameisAI
- whether this client is an artificial intelligencetoken
- the player's token objectclientId
- the clientId of the client acting as this playerpublic Player(String name, boolean isAI, Token token, int clientId, GameModel gameModel)
name
- the player's nameisAI
- whether this client is an artificial intelligencetoken
- the player's token objectclientId
- the clientId of the client acting as this playergameModel
- the GameModel the player belongs topublic void setTileList(ArrayList<Tile> tileList)
tileList
- an ArrayList of tiles to be addedpublic int getClientId()
getClientId
in interface IPlayer
public ArrayList<Tile> getTiles()
public Iterator<Tile> getTilesIterator()
getTilesIterator
in interface IPlayer
public KickState getKickState()
getKickState
in interface IPlayer
public int getColorId()
getColorId
in interface IPlayer
public void setColorId(int id)
setColorId
in interface IPlayer
public void setKickState(KickState kickState)
setKickState
in interface IPlayer
public boolean hasOnHand(Tile tile)
tile
- the tile to check forpublic boolean hasOnHand(int tileId)
public void removeTile(Tile tile)
tile
- the very Tile object to be removedpublic Client getClient()
Copyright © 2017 smarTen. All rights reserved.