Class TileStorageComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.tile.TileStorageComponent
A component that is used to track the status of the unit placed on a tile, it is also used for
adding and removing the units from the tile.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetArea()
int
Gets the position of the tileGets the unit that a tile storesboolean
hasUnit()
Checks if a unit is being stored by this tilevoid
Removes the unit from the tilevoid
setPosition
(int position) Sets the position of the tileboolean
setTileUnit
(Entity unit) Sets the unit of a tileMethods inherited from class com.csse3200.game.components.Component
create, dispose, earlyUpdate, getEntity, getPriority, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
TileStorageComponent
-
-
Method Details
-
setTileUnit
Sets the unit of a tile- Parameters:
unit
- the unit being added to the tile
-
getTileUnit
Gets the unit that a tile stores- Returns:
- the unit of a tile
-
removeTileUnit
public void removeTileUnit()Removes the unit from the tile -
hasUnit
public boolean hasUnit()Checks if a unit is being stored by this tile- Returns:
- a boolean value for if the tile has a unit
-
getPosition
public int getPosition()Gets the position of the tile- Returns:
- the tile's position
-
setPosition
public void setPosition(int position) Sets the position of the tile- Parameters:
position
- the position for the tile to be set at
-
getArea
-