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"
|
|
|
|
|
2019-08-14 13:56:25 +02:00
|
|
|
local gui = require "game.modules.gui"
|
|
|
|
|
2019-03-10 13:26:20 +01:00
|
|
|
|
|
|
|
function BattleSystem:new()
|
2019-03-10 13:33:38 +01:00
|
|
|
BattleSystem.super.new(self)
|
2019-08-14 13:56:25 +02:00
|
|
|
|
2019-08-13 21:08:37 +02:00
|
|
|
self.assets:batchImport("scenes.battlesystem.assets")
|
2019-08-14 13:56:25 +02:00
|
|
|
self.frame = gui.newBorder(424, 30, 8)
|
2019-08-13 21:08:37 +02:00
|
|
|
|
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.datas = {}
|
|
|
|
self.battlearena = BattleArena(self)
|
|
|
|
self.actormanager = ActorManager(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.battlearena:update(dt)
|
|
|
|
self.cursor:update(dt)
|
|
|
|
|
|
|
|
self.actormanager:update(dt)
|
2019-03-10 13:11:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function BattleSystem:draw()
|
2019-03-10 13:26:20 +01:00
|
|
|
self.battlearena:draw()
|
|
|
|
self.cursor:drawBottom()
|
|
|
|
self.battlearena:drawEntities()
|
|
|
|
self.cursor:drawTop()
|
2019-08-14 13:56:25 +02:00
|
|
|
|
|
|
|
love.graphics.draw(self.frame, 424, 20, 0, -1, -1)
|
2019-03-10 13:26:20 +01:00
|
|
|
self.actormanager:draw()
|
2019-03-10 13:11:26 +01:00
|
|
|
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
|