Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from HarambobEngine.Scene import Scene
- class SceneManager:
- '''
- The SceneManager class manages all scenes that exist within the game
- It holds the current scene, acts as a storage units for scenes currently not in use
- and is able to interact directly with scenes.
- '''
- instance = None
- currentScene = None
- scenes = []
- def AddScene (self, scene: Scene):
- '''
- Adds a scene to the SceneManager.scenes list
- :param scene:
- :return:
- '''
- self.scenes.append (scene)
- def SetCurrentScene (self, sceneName: str):
- for scene in self.scenes:
- if scene.name == sceneName:
- self.currentScene = scene
- @classmethod
- def GetInstance (cls) -> instance:
- '''
- Public static factory method, keeps it's instance in SceneManager.instance
- :return:
- '''
- if isinstance (SceneManager.instance, SceneManager):
- return SceneManager.instance
- SceneManager.instance = SceneManager ()
- return SceneManager.instance
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement