2023-03-27 16:07:42 +02:00
|
|
|
import uuid
|
2023-03-27 11:46:03 +02:00
|
|
|
from abc import abstractmethod
|
2023-03-29 15:40:15 +02:00
|
|
|
from typing import Optional
|
2023-03-27 11:46:03 +02:00
|
|
|
|
|
|
|
from level.Level import Level
|
|
|
|
from physics.SpriteManager import SpriteManager
|
|
|
|
from sprite.SpritesheetManager import SpritesheetManager
|
|
|
|
|
|
|
|
|
|
|
|
class LevelElement:
|
2023-03-29 15:40:15 +02:00
|
|
|
def __init__(self, tile: dict, loaded_level, level_screen_manager: 'LevelScreenManager'):
|
2023-03-27 11:46:03 +02:00
|
|
|
self.tile = tile
|
|
|
|
self.loaded_level = loaded_level
|
2023-03-29 15:40:15 +02:00
|
|
|
self.level_screen_manager: 'LevelScreenManager' = level_screen_manager
|
2023-03-27 11:46:03 +02:00
|
|
|
|
2023-03-27 16:07:42 +02:00
|
|
|
if 'id' in tile:
|
|
|
|
self.id = tile['id']
|
|
|
|
else:
|
|
|
|
self.id = uuid.uuid4()
|
|
|
|
|
2023-03-27 11:46:03 +02:00
|
|
|
@abstractmethod
|
|
|
|
def load(self, sprite_manager: SpriteManager, spritesheet_manager: SpritesheetManager, level: Level):
|
|
|
|
pass
|