Package it.polimi.ingsw.Model
Class Tower
java.lang.Object
it.polimi.ingsw.Model.Tower
- All Implemented Interfaces:
Serializable
Allows for the representation of the game's tower pawn
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate final TowerColour
private static final long
private final TowerStorage
-
Constructor Summary
ConstructorDescriptionTower
(TowerColour colour, TowerStorage storage) Creates a Tower by assigning it a colour and a storage. -
Method Summary
Modifier and TypeMethodDescriptionGet the colour of the towervoid
Send the tower back to itsTowerStorage
.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
colour
-
storage
-
-
Constructor Details
-
Tower
Creates a Tower by assigning it a colour and a storage. A tower may find itself inside the storage or outside of it, in which case it has the ability to return to its storage on its own.- Parameters:
colour
- theTowerColour
assigned to the towerstorage
- theTowerStorage
object responsible for storing towers during the game
-
-
Method Details
-
getColour
Get the colour of the tower- Returns:
- the
TowerColour
of the tower
-
linkBackToStorage
Send the tower back to itsTowerStorage
. If the tower is already back in storage, then nothing is done.- Throws:
InvalidElementException
- ifgetColour()
is different thanTowerStorage.getColour()
-