19 lines
465 B
Python
19 lines
465 B
Python
from .singleton import Singleton
|
|
|
|
|
|
class SceneManager(metaclass=Singleton):
|
|
def __init__(self, scene):
|
|
super().__init__()
|
|
self.scene = scene
|
|
self.scene.load()
|
|
|
|
def change_scene(self, new_scene):
|
|
self.scene.unload()
|
|
self.scene = new_scene
|
|
self.scene.load()
|
|
|
|
def step(self):
|
|
for entity in self.scene.entities.values():
|
|
if entity.script is not None:
|
|
entity.script(entity)
|