Hi guys,
I am planning to use timers mechanics for Damage Over Time functionality. I am essentially going to have an array of Damage effects that stack on character, and for each of them I am planning to have a separate timer that ticks and deals damage to player. The problem is, I will want to stop the timer and destroy the damage effect after some time. The only viable solution I found for that is as following: every OnTick event fire of the player character I would get through the damage effects array and for each of them check, how long did the timer tick, and if it’s ticking long enough - stop it. It seems a little too slow and expensive for the code to run like this - I will have my OnTick go through array, and same time the timers for each DoT will be ticking by themselves.
Is there any way of actually clearing timer in its delegate function’s body, to which I set that timer? It would be great to actually let the timers handle their lifetime by themselves - when they tick long enough, they could just destroy themselves. I did not find a way to do that yet