You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- local GameObject = {}
-
- function GameObject.extend(target)
- target.components_ = {}
-
- function target:checkComponent(name)
- return self.components_[name] ~= nil
- end
-
- function target:addComponent(component)
- self.components_[component:getName()] = component
- component:bind_(self)
- return component
- end
-
- function target:removeComponent(name)
- local component = self.components_[name]
- if component then component:unbind_() end
- self.components_[name] = nil
- end
-
- function target:getComponent(name)
- return self.components_[name]
- end
-
- return target
- end
-
- return GameObject
|