diff --git a/sonic-radiance.love/game/init.lua b/sonic-radiance.love/game/init.lua index ad712ff..c95d3f1 100644 --- a/sonic-radiance.love/game/init.lua +++ b/sonic-radiance.love/game/init.lua @@ -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) diff --git a/sonic-radiance.love/game/skills.lua b/sonic-radiance.love/game/skills.lua new file mode 100644 index 0000000..bdbc345 --- /dev/null +++ b/sonic-radiance.love/game/skills.lua @@ -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