Update 'garbageTruck.py'

This commit is contained in:
Maksymilian Szygenda 2023-03-26 20:58:43 +02:00
parent 298fba3f6d
commit bfd78aee90

View File

@ -1,33 +1,35 @@
from typing import List from typing import List
class garbageTruck: class GarbageTruck:
position: List[int, int] position: Tuple[int, int]
paper: [] paper: []
plastic_and_metal: [] plastic_and_metal: []
glass: [] glass: []
bio: [] bio: []
mixed: [] mixed: []
truckSpritePath = 'imgs/dust_car.png' RecognizedGarbage: []
def __init__(self, position: List[int, int]) -> None: truckSpritePath = 'imgs/dust_car.png'
self.position = position def __init__(self, position: List[int, int]) -> None:
self.paper = [] self.position = position
self.plastic_and_metal = [] self.paper = []
self.glass = [] self.plastic_and_metal = []
self.bio = [] self.glass = []
self.mixed = [] self.bio = []
self.mixed = []
def sort_garbage(self, RecognizedGarbage) -> None:
if RecognizedGarbage.garbage_type == 0:
self.paper.append(RecognizedGarbage) def sort_garbage(self, RecognizedGarbage) -> None:
if RecognizedGarbage.garbage_type == 0:
elif RecognizedGarbage.garbage_type == 1: self.paper.append(RecognizedGarbage)
self.plastic_and_metal.append(RecognizedGarbage)
elif RecognizedGarbage.garbage_type == 1:
elif RecognizedGarbage.garbage_type == 3: self.plastic_and_metal.append(RecognizedGarbage)
self.glass.append(RecognizedGarbage)
elif RecognizedGarbage.garbage_type == 3:
elif RecognizedGarbage.garbage_type == 4: self.glass.append(RecognizedGarbage)
self.bio.append(RecognizedGarbage)
elif RecognizedGarbage.garbage_type == 4:
elif RecognizedGarbage.garbage_type == 5: self.bio.append(RecognizedGarbage)
elif RecognizedGarbage.garbage_type == 5:
self.mixed.append(RecognizedGarbage) self.mixed.append(RecognizedGarbage)