Skip to content

Latest commit

 

History

History
18 lines (16 loc) · 883 Bytes

Manual-Timers.md

File metadata and controls

18 lines (16 loc) · 883 Bytes

Timers

In ME.ECS there are timers which give you an ability to store custom timer per entity and custom index.
Timers will be updated automatically and always tick backwards from your value to zero.
You can check timer value every time you want to get actual timer value.
Timer value storing per entity and your custom index in the state class.

For example:

entity.SetTimer(yourCustomTimerIndex, time); // set new timer value or replace existing value with the new one
var value = entity.ReadTimer(yourCustomTimerIndex); // value = time
ref var newValue = ref entity.GetTimer(yourCustomTimerIndex); // value = time
newValue = 0f; // at the next tick after settings 0 value - timer will be destroyed for this entity
entity.Remove(yourCustomTimerIndex); // returns true