Package model
Class Building
java.lang.Object
model.Entity
model.Building
- All Implemented Interfaces:
Serializable
Implements the Building Entity type.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Returns if the building can be upgraded.protected boolean
Returns if the building is destroyed.protected boolean
Determines if the Barrack instance is upgraded to train special units.protected int
Returns the building's upgrade cost.Fields inherited from class model.Entity
animObj, damage, healthPoints, isAlive, isAnimated, maxHealthPoints, owner, position, range, side, size, type, value
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Destroys the Building instance, converts it to a ruin.getImage()
Gets the name of correct sprite.abstract int
Returns the upgrade cost of the Building instance.boolean
Returns if the Building instance is a ruin.void
setDestroyed
(boolean destroyed) Sets if the Building instance is destroyed.abstract void
upgrade()
Upgrades the Building instance, implementation depends on Building type.Methods inherited from class model.Entity
getAnimObj, getDamage, getHealthPoints, getMaxHealthPoints, getOwner, getPosition, getSide, getSize, getType, getValue, invert, isAlive, isAnimated, killUnit, setAlive, setAnimated, setIsAnimated, setOwner, setPosition, setSide, takeDamage
-
Field Details
-
canUpgrade
protected boolean canUpgradeReturns if the building can be upgraded. -
isDestroyed
protected boolean isDestroyedReturns if the building is destroyed. -
isUpgraded
protected boolean isUpgradedDetermines if the Barrack instance is upgraded to train special units. -
upgradeCost
protected int upgradeCostReturns the building's upgrade cost.
-
-
Constructor Details
-
Building
Constructs a new Building instance.- Parameters:
position
- the building's position on the Mapside
- the side it belongs to
-
Building
Constructs a new Building instance.- Parameters:
position
- the building's position on the Map
-
-
Method Details
-
destroy
public void destroy()Destroys the Building instance, converts it to a ruin. -
isDestroyed
public boolean isDestroyed()Returns if the Building instance is a ruin.- Returns:
- if the Building instance is a ruin
-
setDestroyed
public void setDestroyed(boolean destroyed) Sets if the Building instance is destroyed.- Parameters:
destroyed
- if the Building instance is destroyed
-
getImage
Description copied from class:Entity
Gets the name of correct sprite. -
upgrade
public abstract void upgrade()Upgrades the Building instance, implementation depends on Building type. -
getUpgradeCost
public abstract int getUpgradeCost()Returns the upgrade cost of the Building instance.- Returns:
- the upgrade cost of the Building instance
-