|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsimogl.gameobjects.AbstractGameObject
simogl.gameobjects.building.AbstractBuilding
public abstract class AbstractBuilding
This abstract class is the basic version of a building. Any specialized building must extend this class.
| Field Summary | |
|---|---|
static int |
CITY_HALL
|
static int |
FARM
|
static int |
HOUSE
|
int |
type
|
| Constructor Summary | |
|---|---|
AbstractBuilding(int type,
float x,
float y,
float z,
int price,
int regCosts,
int taxRate,
int inhabLimit)
Creates a new abstract building |
|
| Method Summary | |
|---|---|
void |
addToScene()
Adds the building to the scene, if there is no collision with other buildings. |
void |
decreaseNumberInhabitants(int amount)
Decrease the number of inhabitants of the building by the specified amount. |
void |
deleteBuilding()
Call this method to delete the building and everything that is connected to it (inhabitants, particle effects) from the scene. |
int |
getFoodConsumption()
Returns the sum of food that gets consumed during every time intervall. |
int |
getNumberInhabitants()
Returns the number of inhabitants belonging to this building |
int |
getPrice()
Returns the costs for contruction of the building |
int |
getRegularCosts()
Returns the regular cost for running the building |
int |
getTaxes()
Returns the total tax payments of this building, according to the tax rate multiplied by the number of inhabitants. |
int |
getTaxRate()
Returns the taxes per inhabitant of the building |
static int |
getTotalNumberInhabitants()
Returns the total number of inhabitant. |
int |
getType()
Returns the type of the building as a constant. |
void |
increaseNumberInhabitants(int amount)
Increase the number of inhabitants of the building by the specified amount. |
void |
setPrice(int price)
Sets the price for the building |
void |
setRegularCost(int regCosts)
Sets the regular costs for running the building |
void |
setTaxRate(int taxRate)
Sets the price for the building |
void |
setVisibleBox(boolean showBox)
Determines whether the (bounding) box of the bilding should be displayed. |
void |
update(long elapsedTime)
Updates a game object |
| Methods inherited from class simogl.gameobjects.AbstractGameObject |
|---|
getModel, getName, getPosition, getX, getY, getZ, setPosition, setPosition, setX, setY, setZ |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int HOUSE
public static final int FARM
public static final int CITY_HALL
public int type
| Constructor Detail |
|---|
public AbstractBuilding(int type,
float x,
float y,
float z,
int price,
int regCosts,
int taxRate,
int inhabLimit)
type - the constant describing the building. E.g. AbstractBuilding.HOUSEx - x-coordinatey - y-coordinatez - z-coordinateprice - cost for construction of this buildingregCosts - regluar costs for running the buildingtaxRate - taxes per inhabitant of the buildinginhabLimit - maximaum possible number of inhabitants for the building.
Inhabitants are people that pay taxes, so only asign a number greater 0
to building that shall be considered for tax paying| Method Detail |
|---|
public void decreaseNumberInhabitants(int amount)
amount - number of inhabitants to subtract from the buildingpublic void increaseNumberInhabitants(int amount)
amount - number of inhabitants to add to the buildingpublic void deleteBuilding()
public void addToScene()
public void setVisibleBox(boolean showBox)
showBox - show (bounding) box? true=yes, false=nopublic int getType()
public int getNumberInhabitants()
public static int getTotalNumberInhabitants()
public int getFoodConsumption()
public int getPrice()
public void setPrice(int price)
price - price for the buildingpublic int getRegularCosts()
public void setRegularCost(int regCosts)
regCosts - regular costs for running the buildingpublic int getTaxRate()
public void setTaxRate(int taxRate)
taxRate - tax rate for the buildingpublic int getTaxes()
public void update(long elapsedTime)
AbstractGameObject
update in class AbstractGameObjectelapsedTime - time between two frames
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||