30 lines
656 B
Python
30 lines
656 B
Python
from .observer import Observer
|
|
|
|
|
|
class Entity(Observer):
|
|
def __init__(self, name):
|
|
super().__init__()
|
|
self._components = []
|
|
self.name = name
|
|
self.scene = None
|
|
self.x = 0
|
|
self.y = 0
|
|
self.script = None
|
|
|
|
def load(self):
|
|
pass
|
|
|
|
def add(self, component):
|
|
component.parent = self
|
|
component.load()
|
|
self._components.append(component)
|
|
return component
|
|
|
|
def register(self):
|
|
for component in self._components:
|
|
component.register()
|
|
|
|
def unregister(self):
|
|
for component in self._components:
|
|
component.unregister()
|