mirror of
https://inf.pirckheimer-gymnasium.de/kebab/kebab
synced 2026-09-25 16:34:28 +00:00
Upgrade-, Arbeiter- und Kundensystem hinzugefügt
This commit is contained in:
1 parent
ffef57c34e
commit
9640f3db12
1 file changed
+89
-4
@@ -1,13 +1,15 @@
|
||||
package project.utils;
|
||||
|
||||
public class Ordersystem {
|
||||
private int money = 0;
|
||||
private int kebabPrice = 5;
|
||||
private int upgradeLevel = 0;
|
||||
private int kebabSold = 0;
|
||||
private int workers = 0;
|
||||
private int waitingCustomers = 0;
|
||||
private int totalEarned = 0;
|
||||
|
||||
|
||||
public void sellKebab() {
|
||||
money += kebabPrice;
|
||||
kebabSold++;
|
||||
}
|
||||
public int getMoney(){
|
||||
return money;
|
||||
}
|
||||
@@ -18,6 +20,89 @@ public class Ordersystem {
|
||||
public void setKebabPrice(int price){
|
||||
kebabPrice = price;
|
||||
}
|
||||
public boolean buyUpgrade() {
|
||||
int cost = (upgradeLevel + 1) * 50;
|
||||
|
||||
if(money >= cost) {
|
||||
money -= cost;
|
||||
upgradeLevel++;
|
||||
kebabPrice += 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getUpgradeLevel() {
|
||||
return upgradeLevel;
|
||||
}
|
||||
|
||||
public boolean buyWorker() {
|
||||
|
||||
int cost = getWorkerCost();
|
||||
|
||||
if(money >= cost) {
|
||||
money -= cost;
|
||||
workers++;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getWorkers() {
|
||||
return workers;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void addCustomer() {
|
||||
waitingCustomers++;
|
||||
}
|
||||
|
||||
public boolean sellKebab() {
|
||||
if(waitingCustomers > 0) {
|
||||
waitingCustomers--;
|
||||
money += kebabPrice;
|
||||
totalEarned += kebabPrice;
|
||||
kebabSold++;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public int getTotalIncome() {
|
||||
return totalEarned;
|
||||
}
|
||||
|
||||
public int getWaitingCustomers() {
|
||||
|
||||
return waitingCustomers;
|
||||
}
|
||||
|
||||
public int getKebabPrice() {
|
||||
return kebabPrice;
|
||||
}
|
||||
|
||||
public int getUpgradeCost() {
|
||||
return (upgradeLevel + 1) * 50;
|
||||
}
|
||||
|
||||
public int getWorkerCost() {
|
||||
return 100 + workers * 50;
|
||||
}
|
||||
|
||||
public void workerSellKebabs() {
|
||||
for(int i = 0; i < workers; i++) {
|
||||
if (waitingCustomers > 0) {
|
||||
sellKebab();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user