sonic-radiance/sonic-radiance.love/scenes/battlesystem/choregraphy/mixins/counters.lua

19 lines
427 B
Lua
Raw Normal View History

2021-08-08 09:49:43 +02:00
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