Add comments and add/remove method to Credit class.
This commit is contained in:
parent
04944e0391
commit
a10c798afd
|
@ -1,17 +1,47 @@
|
||||||
package de.teamteamteam.spacescooter.gui;
|
package de.teamteamteam.spacescooter.gui;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Static class accounting the credits a player earned during the game.
|
||||||
|
*/
|
||||||
public class Credits {
|
public class Credits {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Credit points for the shop
|
* Credit points for the shop
|
||||||
*/
|
*/
|
||||||
private static int credits = 1000;
|
private static int credits = 1000;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private constructor.
|
||||||
|
*/
|
||||||
|
private Credits() { }
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current amount of credits.
|
||||||
|
*/
|
||||||
public static int getCredits() {
|
public static int getCredits() {
|
||||||
return credits;
|
return credits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current amount of credits.
|
||||||
|
*/
|
||||||
public static void setCredits(int credits) {
|
public static void setCredits(int credits) {
|
||||||
Credits.credits = credits;
|
Credits.credits = credits;
|
||||||
System.out.println(credits);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a number of credits to the credits account.
|
||||||
|
*/
|
||||||
|
public static void add(int credits) {
|
||||||
|
Credits.credits += credits;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a number of credits to the credits account.
|
||||||
|
*/
|
||||||
|
public static void remove(int credits) {
|
||||||
|
Credits.credits -= credits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue