19 lines
462 B
Python
19 lines
462 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:
|
|
if entity.script is not None:
|
|
entity.script(entity)
|