2023-04-03 15:49:28 +02:00
|
|
|
from typing import List
|
2023-03-26 21:29:40 +02:00
|
|
|
from garbageCan import GarbageCan
|
2023-04-03 15:49:28 +02:00
|
|
|
from street import Street
|
|
|
|
from gameContext import GameContext
|
2023-03-26 21:29:40 +02:00
|
|
|
|
|
|
|
class Node:
|
|
|
|
garbageCan: GarbageCan
|
|
|
|
id: int
|
|
|
|
|
|
|
|
def __init__(self, id: int, can: GarbageCan) -> None:
|
2023-04-03 15:49:28 +02:00
|
|
|
self.id
|
2023-03-26 21:29:40 +02:00
|
|
|
self.can = can
|
|
|
|
|
|
|
|
class City:
|
|
|
|
nodes: List[Node]
|
2023-04-03 15:49:28 +02:00
|
|
|
streets: List[Street]
|
2023-03-26 21:29:40 +02:00
|
|
|
|
|
|
|
def __init__(self) -> None:
|
|
|
|
self.nodes = []
|
|
|
|
self.streets = []
|
|
|
|
|
|
|
|
def add_node(self, node: Node) -> None:
|
|
|
|
self.nodes.append(node)
|
|
|
|
|
2023-04-03 15:49:28 +02:00
|
|
|
def add_street(self, street: Street) -> None:
|
|
|
|
self.streets.append(street)
|
2023-03-26 21:29:40 +02:00
|
|
|
|
2023-04-03 15:49:28 +02:00
|
|
|
def render_city(self, game_context: GameContext) -> None:
|
|
|
|
self._render_streets(game_context)
|
2023-04-23 15:34:29 +02:00
|
|
|
self._render_nodes(game_context)
|
2023-04-03 15:49:28 +02:00
|
|
|
|
|
|
|
def _render_streets(self, game_context: GameContext) -> None:
|
|
|
|
for street in self.streets:
|
2023-04-23 15:34:29 +02:00
|
|
|
street.render(game_context)
|
|
|
|
|
|
|
|
def _render_nodes(self, game_context: GameContext) -> None:
|
|
|
|
for node in self.nodes:
|
|
|
|
node.render(game_context)
|