scenes/battlesystem: merge battlesystem controller with scene object

This commit is contained in:
Kazhnuz 2019-03-10 13:26:20 +01:00
parent cb92a8fb3b
commit b3bbde1232

View file

@ -1,15 +1,36 @@
local BattleSystem = {} local Scene = require "core.modules.scenes"
local Controller = require "scenes.battlesystem.controller"
function BattleSystem:enter() local BattleSystem = Scene:extend()
self.controller = Controller()
--self.background = love.graphics.newImage("assets/background/testbackground.png") 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 BattleSystem:new()
self:initManagers()
end
function BattleSystem: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 end
function BattleSystem:update(dt) function BattleSystem:update(dt)
game:update(dt) self.hud:update(dt)
game.input:update(dt) self.battlearena:update(dt)
self.controller:update(dt) self.cursor:update(dt)
self.assets:update(dt)
self.actormanager:update(dt)
self.menusystem:update(dt)
end end
function BattleSystem:draw() function BattleSystem:draw()
@ -17,13 +38,20 @@ function BattleSystem:draw()
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.rectangle("fill", 0, 0, 424, 240) love.graphics.rectangle("fill", 0, 0, 424, 240)
--love.graphics.draw(self.background, 0, 0) --love.graphics.draw(self.background, 0, 0)
self.controller:draw() self.battlearena:draw()
self.cursor:drawBottom()
self.battlearena:drawEntities()
self.cursor:drawTop()
self.hud:draw()
self.actormanager:draw()
self.menusystem:draw(dt)
--CScreen:cease() --CScreen:cease()
end end
function BattleSystem:leave() function BattleSystem:exit()
self.controller:destroy() self.world:destroy()
self.controller = nil self.battlearena = nil
collectgarbage() collectgarbage()
end end