mirror of
https://inf.pirckheimer-gymnasium.de/kebab/kebab
synced 2026-08-26 16:31:23 +00:00
Upgrade-, Arbeiter- und Kundensystem hinzugefügt
This commit is contained in:
@@ -1,13 +1,15 @@
|
|||||||
|
package project.utils;
|
||||||
|
|
||||||
public class Ordersystem {
|
public class Ordersystem {
|
||||||
private int money = 0;
|
private int money = 0;
|
||||||
private int kebabPrice = 5;
|
private int kebabPrice = 5;
|
||||||
private int upgradeLevel = 0;
|
private int upgradeLevel = 0;
|
||||||
private int kebabSold = 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(){
|
public int getMoney(){
|
||||||
return money;
|
return money;
|
||||||
}
|
}
|
||||||
@@ -18,6 +20,89 @@ public class Ordersystem {
|
|||||||
public void setKebabPrice(int price){
|
public void setKebabPrice(int price){
|
||||||
kebabPrice = 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