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
FieldsModifier and TypeFieldDescriptionprivate final TowerColourprivate static final longprivate final TowerStorage -
Constructor Summary
ConstructorsConstructorDescriptionTower(TowerColour colour, TowerStorage storage) Creates a Tower by assigning it a colour and a storage. -
Method Summary
Modifier and TypeMethodDescriptionGet the colour of the towervoidSend 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- theTowerColourassigned to the towerstorage- theTowerStorageobject responsible for storing towers during the game
-
-
Method Details
-
getColour
Get the colour of the tower- Returns:
- the
TowerColourof 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()
-