This repository has been archived on 2019-12-09. You can view files and clone it, but cannot push or open issues or pull requests.
pacman2/engine/scene.py

18 lines
406 B
Python
Raw Permalink Normal View History

2019-11-23 10:46:25 +01:00
class Scene:
def __init__(self):
2019-12-09 09:57:53 +01:00
self.entities = {}
2019-11-23 10:46:25 +01:00
2019-12-09 12:36:42 +01:00
def add(self, entity):
self.entities[entity.name] = entity
entity.scene = self
entity.load()
2019-12-09 20:51:45 +01:00
return entity
2019-12-09 12:36:42 +01:00
2019-11-23 10:46:25 +01:00
def unload(self):
2019-12-09 09:57:53 +01:00
for entity in self.entities.values():
2019-11-23 10:46:25 +01:00
entity.unregister()
def load(self):
2019-12-09 09:57:53 +01:00
for entity in self.entities.values():
2019-11-23 10:46:25 +01:00
entity.register()