2019-03-10 13:26:20 +01:00
|
|
|
local Scene = require "core.modules.scenes"
|
2019-03-10 13:11:26 +01:00
|
|
|
|
2019-03-10 13:26:20 +01:00
|
|
|
local BattleSystem = Scene:extend()
|
|
|
|
|
|
|
|
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()
|
2019-03-10 13:33:38 +01:00
|
|
|
BattleSystem.super.new(self)
|
2019-03-10 13:26:20 +01:00
|
|
|
self:initManagers()
|
2019-03-10 13:33:38 +01:00
|
|
|
|
|
|
|
self:register()
|
2019-03-10 13:26:20 +01:00
|
|
|
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)
|
2019-03-23 11:51:47 +01:00
|
|
|
self.menu = MenuSystem(self)
|
2019-03-10 13:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function BattleSystem:update(dt)
|
2019-03-10 13:26:20 +01:00
|
|
|
self.hud:update(dt)
|
|
|
|
self.battlearena:update(dt)
|
|
|
|
self.cursor:update(dt)
|
|
|
|
|
|
|
|
self.actormanager:update(dt)
|
2019-03-23 11:51:47 +01:00
|
|
|
self.menu:update(dt)
|
2019-03-10 13:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function BattleSystem:draw()
|
|
|
|
--CScreen:apply()
|
|
|
|
love.graphics.setColor(1, 1, 1, 1)
|
|
|
|
love.graphics.rectangle("fill", 0, 0, 424, 240)
|
|
|
|
--love.graphics.draw(self.background, 0, 0)
|
2019-03-10 13:26:20 +01:00
|
|
|
self.battlearena:draw()
|
|
|
|
self.cursor:drawBottom()
|
|
|
|
self.battlearena:drawEntities()
|
|
|
|
self.cursor:drawTop()
|
|
|
|
self.hud:draw()
|
|
|
|
self.actormanager:draw()
|
|
|
|
|
2019-03-23 11:51:47 +01:00
|
|
|
self.menu:draw(dt)
|
2019-03-10 13:11:26 +01:00
|
|
|
--CScreen:cease()
|
|
|
|
end
|
|
|
|
|
2019-03-10 13:26:20 +01:00
|
|
|
function BattleSystem:exit()
|
|
|
|
self.world:destroy()
|
|
|
|
self.battlearena = nil
|
2019-03-10 13:11:26 +01:00
|
|
|
|
|
|
|
collectgarbage()
|
|
|
|
end
|
|
|
|
|
|
|
|
return BattleSystem
|