#include "component_animation_levitate.h"

/* DEPENDENCIES: GameObject */

/* Sets animation_levitate component info. */
void
component_animation_levitate_init(ComponentAnimationLevitate* self, f32 height, f32 range, f32 speed)
{
	self->height = height;
	self->range = range;
	self->speed = speed;
}

/* Ticks animation_levitate component. */
void
component_animation_levitate_tick(ComponentAnimationLevitate* self, ECS* ecs)
{
	ComponentGameObject* gameObject;

	f32 angle;

	gameObject = ecs_component_get(ecs, ECS_COMPONENT_GAME_OBJECT, self->component.id);

	gameObject->height = self->height + (cos(self->timer * self->speed) * self->range);

	self->timer++;
}
