#include "component_timer.h"

/* Sets timer component info. */
void
component_timer_init(ComponentTimer* self, u32 value)
{
	self->max = value;
	self->value = self->max;
}

/* Ticks timer component. */
void
component_timer_tick(ComponentTimer* self, ECS* ecs)
{
	if (self->isDone)
		return;

	self->value--;

	if (self->value <= 0)
	{
		self->value = 0;
		self->isDone = true;
	}
}
