game: add a sonicboost handler

This commit is contained in:
Kazhnuz 2019-02-04 08:36:29 +01:00
parent 639da2abd2
commit 8cb038eddf
3 changed files with 23 additions and 1 deletions

View file

@ -25,12 +25,16 @@
local Game = Object:extend() local Game = Object:extend()
local SonicBoost = require "game.subgame.sonic-boost"
local binser = require "libs.binser" local binser = require "libs.binser"
function Game:new() function Game:new()
self.slot = -1 self.slot = -1
self.gametime = 0 self.gametime = 0
self.subgame = {}
self.subgame.sonicboost = SonicBoost(self)
end end
function Game:setData(data) function Game:setData(data)

View file

@ -0,0 +1,18 @@
local SonicBoost = Object:extend()
function SonicBoost:new(controller)
self.controller = controller
self.datas = {}
self.datas.characters = require "datas.characters"
end
function SonicBoost:getCharacterData(name)
return self.datas.character[name]
end
function SonicBoost:getData()
return self.datas
end
return SonicBoost

View file

@ -73,7 +73,7 @@ function Character:new(charcontroller, rail, character, id)
end end
function Character:characterInit(char) function Character:characterInit(char)
self.data = game.characters:getCharacterData(char) self.data = game.subgame.sonicboost:getCharacterData(char)
self.lifeicon = self.data.assets.lifeicon self.lifeicon = self.data.assets.lifeicon
end end