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

19 lines
427 B
Lua
Raw Permalink Normal View History

2021-11-25 10:57:13 +01: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