|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsimogl.resource.AbstractResource
public abstract class AbstractResource
This class represents an abstract resource. Concrete resources like gold or food can be generated by extending this class.
| Constructor Summary | |
|---|---|
AbstractResource(int amount,
long intervall)
Creates a new resource with the specified initial amount. |
|
| Method Summary | |
|---|---|
void |
decrease(int amount)
Decrease the resource about the specified amount |
int |
getCurrentAmount()
Returns the current amount of the resource |
long |
getUpdateIntervall()
Returns the intervall on which the resource gets recalculated |
void |
increase(int amount)
Increase the resource about the specified amount |
void |
setCurrentAmount(int amount)
Sets the current amount of the resource to the specified value |
void |
setUpdateIntervall(long intervall)
Sets the new intervall on which the resource gets recalculated |
abstract void |
update(long elapsedTime)
Recalculates the available amount of the resource |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractResource(int amount,
long intervall)
amount - initial amount of the resourceintervall - intervall of time in miliseconds in which
calculations on resources will be performed, effecting the
amount of the player's resources| Method Detail |
|---|
public long getUpdateIntervall()
public void setUpdateIntervall(long intervall)
intervall - new intervall for recalculating the resource's
amountpublic int getCurrentAmount()
public void setCurrentAmount(int amount)
amount - new current amount of the resourcepublic void increase(int amount)
amount - amount to increase the resourcepublic void decrease(int amount)
amount - amount to decrease the resourcepublic abstract void update(long elapsedTime)
elapsedTime - time between two calls of the updater thread
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||