scenes/boost: add controller uniques functions to the scene object

This commit is contained in:
Kazhnuz 2019-02-04 09:30:03 +01:00
parent 62d45d9e4a
commit ca22b918b0

View file

@ -9,6 +9,57 @@ function BoostLevel:new()
self:register()
end
function BoostLevel:initManagers()
--self.loader = Loader()
self.world = World(self)
self.hud = HUD(self)
self.camera = Camera(self, 0, 0)
self.background = Background(self)
self.characters = CharacterManager(self)
--self.pausemenu = PauseMenu(self)
end
function BoostLevel:initMission(levelid)
self:getLevelData(levelid)
self.mission = {}
self.mission.timer = 0
self.mission.completed = false
end
function BoostLevel:startMission()
self.initiated = true
end
function BoostLevel:getLevelData(file)
local file = file or "testlevel.test1"
local level = require("datas.subgame.sonic-boost.levels." .. file)
self.zone = level.datas.zone
local zone_data = zoneDatas[self.zone]
local bypass_data = level.datas.bypass_data
self.datas = {}
if (level.datas.bypass_zone) then
self.datas.name = bypass_data.name or zone_data.name
self.datas.borders = bypass_data.borders or zone_data.borders
self.datas.tiles = bypass_data.tiles or zone_data.tiles
self.datas.background = bypass_data.background or zone_data.background
self.datas.music = bypass_data.music or zone_data.music
else
self.datas = zone_data
end
self.layout = level.layout
self.parts = level.parts
self.endless_parts = level.endless_parts
self.missiondata = level.datas.missiondata
end
function BoostLevel:update(dt)
self.controller:update(dt)
end
@ -17,6 +68,18 @@ function BoostLevel:draw()
self.controller:draw()
end
function BoostLevel:resetFont()
self.assets.fonts["text"]:set()
end
function BoostLevel:restartLevel()
self:new(self.levelid, self.character)
end
function BoostLevel:exitLevel()
Gamestate.switch(Scenes.options)
end
function BoostLevel:leave()
self.controller:destroy()
self.controller = nil