feat(game): add an initial skill handling system
This commit is contained in:
parent
c3451807ce
commit
a439c308d6
2 changed files with 21 additions and 0 deletions
|
@ -26,6 +26,7 @@
|
|||
local Game = Object:extend()
|
||||
local Characters = require "game.characters"
|
||||
local Ennemies = require "game.ennemies"
|
||||
local Skills = require "game.skills"
|
||||
|
||||
local binser = require "core.modules.gamesystem.libs.binser"
|
||||
|
||||
|
@ -38,6 +39,7 @@ function Game:new()
|
|||
|
||||
self.characters = Characters(self)
|
||||
self.ennemies = Ennemies(self)
|
||||
self.skills = Skills(self)
|
||||
end
|
||||
|
||||
function Game:setData(data)
|
||||
|
|
19
sonic-radiance.love/game/skills.lua
Normal file
19
sonic-radiance.love/game/skills.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local SkillManager = Object:extend()
|
||||
|
||||
function SkillManager:new(controller)
|
||||
self.controller = controller
|
||||
end
|
||||
|
||||
function SkillManager:getSkillData(skillname)
|
||||
if self:skillDataExists(skillname) then
|
||||
return require("datas.gamedata.skills." .. skillname )
|
||||
end
|
||||
end
|
||||
|
||||
function SkillManager:skillDataExists(skillname)
|
||||
local dir = "datas/gamedata/skills/" .. skillname .. ".lua"
|
||||
local fileinfo = love.filesystem.getInfo(dir)
|
||||
return (fileinfo ~= nil)
|
||||
end
|
||||
|
||||
return SkillManager
|
Loading…
Reference in a new issue