diff options
author | chai <chaifix@163.com> | 2019-02-22 13:50:12 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-02-22 13:50:12 +0800 |
commit | 22ba8d6af9e9a67e6bac11365df23b6a61fa62c7 (patch) | |
tree | 7e86accc40e3b99b8ae575f718136239fc249d2d /Source/Asura.Framework/scripts/gameobject.lua | |
parent | f756fa0a17675ea70956af9c42f6c1117a84f9bd (diff) |
*修改缩进
Diffstat (limited to 'Source/Asura.Framework/scripts/gameobject.lua')
-rw-r--r-- | Source/Asura.Framework/scripts/gameobject.lua | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/Source/Asura.Framework/scripts/gameobject.lua b/Source/Asura.Framework/scripts/gameobject.lua index cd984ee..fb287fb 100644 --- a/Source/Asura.Framework/scripts/gameobject.lua +++ b/Source/Asura.Framework/scripts/gameobject.lua @@ -8,26 +8,26 @@ AsuraEngine.GameObject = AsuraEngine.Asset.Sub("GameObject") local GameObject = AsuraEngine.GameObject function GameObject:Ctor() - self.transform = AsuraEngine.Transform.New() - self.subentities = {} -- Sub node entities + self.transform = AsuraEngine.Transform.New() + self.subentities = {} -- Sub node entities end function GameObject:AddChild(gameobject) - table.insert(self.child, gameobject) + table.insert(self.child, gameobject) end function GameObject:AddComponent(type, name) - local cname = type - if name == nil then - cname = name - end - local component = AsuraEngine.Component.GetComponent(type) - self.components[cname] = compoennt + local cname = type + if name == nil then + cname = name + end + local component = AsuraEngine.Component.GetComponent(type) + self.components[cname] = compoennt end -- 根据组件名拿到组件 function GameObject:GetComponent(name) - return self.components[name] + return self.components[name] end -- 根据组件类型拿到组件 @@ -36,47 +36,47 @@ function GameObject:GetComponentByType(tname) end function GameObject:OnEnable() - + end function GameObject:OnEvent(e) - if self.components == nil or type(self.components) ~= "table" then - AsuraEditor.LogError("") - return - end - for name, component in self.components do - if component.OnEvent ~= nil then - component:OnEvent(e) - end - end + if self.components == nil or type(self.components) ~= "table" then + AsuraEditor.LogError("") + return + end + for name, component in self.components do + if component.OnEvent ~= nil then + component:OnEvent(e) + end + end end function GameObject:OnUpdate(dt) - for name, component in self.components do - if component.OnUpdate ~= nil then - component:OnUpdate(dt) - end - end + for name, component in self.components do + if component.OnUpdate ~= nil then + component:OnUpdate(dt) + end + end end function GameObject:OnRender() - for name, component in self.components do - if component.OnRender ~= nil then - component.OnRender() - end - end + for name, component in self.components do + if component.OnRender ~= nil then + component.OnRender() + end + end end function GameObject:OnDisable() - for name, component in self.components do - if component.OnDisable ~= nil then - component.OnDisable() - end - end + for name, component in self.components do + if component.OnDisable ~= nil then + component.OnDisable() + end + end end function GameObject:GetTrasform() - return self.transform + return self.transform end function GameObject:GetPosition() |