2023-03-26 14:51:05 +02:00
|
|
|
from garbage import Garbage
|
|
|
|
from typing import List, Tuple
|
2023-04-15 19:37:56 +02:00
|
|
|
from gameContext import GameContext
|
2023-04-22 12:11:06 +02:00
|
|
|
from gridCellType import GridCellType
|
2023-03-26 14:51:05 +02:00
|
|
|
|
|
|
|
class GarbageCan:
|
|
|
|
position: Tuple[int, int]
|
|
|
|
garbage: List[Garbage]
|
2023-05-13 23:06:42 +02:00
|
|
|
is_visited: bool
|
2023-03-26 14:51:05 +02:00
|
|
|
|
|
|
|
def __init__(self, position: Tuple[int, int]) -> None:
|
|
|
|
self.position = position
|
|
|
|
self.garbage = []
|
2023-05-13 23:06:42 +02:00
|
|
|
self.is_visited = False
|
2023-03-26 14:51:05 +02:00
|
|
|
|
|
|
|
def add_garbage(self, garbage: Garbage) -> None:
|
|
|
|
self.garbage.append(garbage)
|
|
|
|
|
|
|
|
def remove_garbage(self, garbage: Garbage) -> None:
|
2023-04-15 19:37:56 +02:00
|
|
|
self.garbage.remove(garbage)
|
|
|
|
|
|
|
|
def render(self, game_context: GameContext) -> None:
|
2023-04-22 12:11:06 +02:00
|
|
|
game_context.render_in_cell(self.position, "imgs/container.png")
|
|
|
|
game_context.grid[self.position] = GridCellType.GARBAGE_CAN
|