Madra_smieciarka/classes.py
2024-03-10 21:24:30 +01:00

78 lines
1.7 KiB
Python

# Robię to wszystko jako obiekty, bo tak później będzie łątwiej dodawać do nich rzeczy, niż przerabiać słowniki
class Trashcan:
def __init__(self, id, image, position, trashtype):
self.id = id
self.image = image
assert isinstance(position, tuple)
self.position = position
self.type = trashtype
self.neighbours = []
def setNeighbours(self, neighbours):
self.neighbours = neighbours
def addNeighbour(self, neighbour):
self.neighbours.append(neighbour)
def getNeighbours(self):
return self.neighbours
def getPosition(self):
return self.position
def getImage(self):
return self.image
def getType(self):
return self.type
def getId(self):
return self.id
class Household:
def __init__(self, id, image, position):
self.id = id
self.image = image
assert isinstance(position, tuple)
self.position = position
self.neighbours = []
def setNeighbours(self, neighbours):
self.neighbours = neighbours
def addNeighbour(self, neighbour):
self.neighbours.append(neighbour)
def getNeighbours(self):
return self.neighbours
def getPosition(self):
return self.position
def getImage(self):
return self.image
def getId(self):
return self.id
class Junkyard:
def __init__(self):
self.id = 0
self.position = (1400, 500)
self.neighbours = []
def getPosition(self):
return self.position
def addNeighbour(self, neighbour):
self.neighbours.append(neighbour)
def getNeighbours(self):
return self.neighbours
def getId(self):
return self.id