Refactor script logic
This commit is contained in:
+17
-13
@@ -1,26 +1,30 @@
|
||||
local Cube = include('entities/cube.lua')
|
||||
|
||||
local SceneCube = {}
|
||||
SceneCube.__index = SceneCube
|
||||
|
||||
local cam
|
||||
local cube
|
||||
|
||||
function Scene:init()
|
||||
print("Scene init")
|
||||
local camId = entityAdd()
|
||||
local pos = entityPositionAdd(camId)
|
||||
pos.x = 3
|
||||
pos.y = 3
|
||||
pos.z = 3
|
||||
pos:lookAt(0, 0, 0)
|
||||
entityCameraAdd(camId)
|
||||
cam = camId
|
||||
function SceneCube:init()
|
||||
cam = Entity.new()
|
||||
cam:add(Entity.POSITION)
|
||||
cam.position.x = 3
|
||||
cam.position.y = 3
|
||||
cam.position.z = 3
|
||||
cam.position:lookAt(0, 0, 0)
|
||||
cam:add(Entity.CAMERA)
|
||||
|
||||
cube = Cube.new()
|
||||
end
|
||||
|
||||
function Scene:update()
|
||||
function SceneCube:update()
|
||||
cube:update()
|
||||
end
|
||||
|
||||
function Scene:dispose()
|
||||
function SceneCube:dispose()
|
||||
cam:dispose()
|
||||
cube:dispose()
|
||||
entityRemove(cam)
|
||||
end
|
||||
|
||||
return SceneCube
|
||||
|
||||
Reference in New Issue
Block a user