64 lines
1.5 KiB
Lua
64 lines
1.5 KiB
Lua
local Controller = Object:extend()
|
|
local GUI = require "modules.gui"
|
|
local Assets = require "modules.assets"
|
|
|
|
local BattleArena = require "scenes.battlesystem.controller.battlearena"
|
|
local ActorManager = require "scenes.battlesystem.controller.actors"
|
|
local HUD = require "scenes.battlesystem.controller.hud"
|
|
local Cursor = require "scenes.battlesystem.controller.cursor"
|
|
local MenuSystem = require "scenes.battlesystem.controller.menu"
|
|
|
|
function Controller:new()
|
|
self.assets = Assets()
|
|
self.gui = GUI()
|
|
|
|
self:initManagers()
|
|
end
|
|
|
|
function Controller:restart()
|
|
end
|
|
|
|
function Controller:exitLevel()
|
|
Gamestate.switch(Scenes.options)
|
|
end
|
|
|
|
function Controller:initManagers()
|
|
--self.loader = Loader()
|
|
self.datas = {}
|
|
self.battlearena = BattleArena(self)
|
|
self.actormanager = ActorManager(self)
|
|
self.hud = HUD(self)
|
|
self.cursor = Cursor(self)
|
|
self.menusystem = MenuSystem(self)
|
|
end
|
|
|
|
function Controller:destroy()
|
|
self.world:destroy()
|
|
self.battlearena = nil
|
|
--self.assets:clear()
|
|
end
|
|
|
|
function Controller:update(dt)
|
|
-- Ici sera tout ce qui se passe dans une update
|
|
self.hud:update(dt)
|
|
self.battlearena:update(dt)
|
|
self.cursor:update(dt)
|
|
self.assets:update(dt)
|
|
|
|
self.actormanager:update(dt)
|
|
self.menusystem:update(dt)
|
|
end
|
|
|
|
function Controller:draw()
|
|
self.battlearena:draw()
|
|
self.cursor:drawBottom()
|
|
self.battlearena:drawEntities()
|
|
self.cursor:drawTop()
|
|
self.hud:draw()
|
|
self.actormanager:draw()
|
|
|
|
self.menusystem:draw(dt)
|
|
|
|
end
|
|
|
|
return Controller
|