Pobieranie dań z kuchni i rozdawanie ich klientom

This commit is contained in:
Sara Kowalska 2020-04-05 19:28:01 +02:00
parent ce1c77af47
commit db80b906da

View File

@ -20,6 +20,7 @@ class Plate(object):
self.isEmpty = False
self.preparationTime = dish.preparationTime
self.eatingTime = dish.eatingTime
self.price = dish.price
def eat(self):
time.sleep(self.eatingTime)
@ -37,6 +38,13 @@ class Kitchen(object):
time.sleep(plate.preparationTime) #kuchnia przygotowuje danie przez określony czas
self.readyDishes.put(plate)
def giveDish(self):
if not self.readyDishes.empty():
plate = self.readyDishes.get()
return plate
else:
return None
class Client(object):
def __init__(self, age, sex, budget):
@ -148,6 +156,18 @@ class Waiter(object):
def resetPosition(self, pos):
self.pos = pos
def takePlates(self, kitchen):
for i in range(2):
plate = kitchen.giveDish()
if plate == None:
break
else:
self.plates.append(plate)
def giveClientPlate(self, client):
plate = self.plates.pop(0)
client.takePlateAndEat(plate)
def draw(self, surface):
i = self.pos[0]
j = self.pos[1]