|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.b3dgs.lionengine.game.strategy.Ressource
public class Ressource
Represent a ressource, such as gold, wood... It is possible to increase the ressource amount, or spend it. It is also possible to check if there are enough ressource before spending it.
Constructor Summary | |
---|---|
Ressource()
Create a new blank ressource. |
|
Ressource(int amount)
Create a new ressource. |
Method Summary | |
---|---|
void |
add(int amount)
Increase ressource stock with a specified amount. |
boolean |
canSpend(int amount)
Check if the specified amount of ressource can be spent. |
int |
get()
Get current amount of ressource. |
void |
spend(int amount)
Decrease ressource stock with a specified amount. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Ressource()
public Ressource(int amount)
amount
- starting amount.Method Detail |
---|
public void add(int amount)
amount
- amount of new ressources.public void spend(int amount)
amount
- amout of ressource to spend.public boolean canSpend(int amount)
amount
- amount to check.
public int get()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |