sonic-bluestreak/sonic-bluestreak.love/scenes/battlesystem/choregraphy/mixins/counters.lua
2021-11-25 10:57:13 +01:00

18 lines
427 B
Lua

local CountersMixin = Object:extend()
function CountersMixin:initCounters()
self.counters = {}
end
function CountersMixin:getCounter(counterName)
return (self.counters[counterName] or 0)
end
function CountersMixin:setCounter(counterName, number, relative)
if (relative == true) then
number = number + self:getCounter(counterName)
end
self.counters[counterName] = number
end
return CountersMixin