#pragma once

#include "ANIMATION_COMMON.h"
#include "../../../GAME_COMMON.h"
#include "../../ecs_entity.h"

#include "../component_sprite.h"

typedef enum AnimationColorChangeMode
{
	ANIMATION_COLOR_CHANGE_MODE_RETURN,
	ANIMATION_COLOR_CHANGE_MODE_STICK,
} AnimationColorChangeMode;

typedef struct ComponentAnimationColorChange
{
	ECSComponent component;
	vec4 toColor;
	vec4 fromColor;
	u32 timer;
	u32 timerMax;
	AnimationColorChangeMode mode;
	bool isDone;
} ComponentAnimationColorChange;

void component_animation_color_change_init
(
	ComponentAnimationColorChange* self, 
	vec4 toColor, 
	vec4 fromColor,
	u32 time,
	AnimationColorChangeMode mode
);
void component_animation_color_change_tick(ComponentAnimationColorChange* self, ECS* ecs);

static const ECSComponentInfo COMPONENT_ANIMATION_COLOR_CHANGE_INFO = 
{
	.system = 
	{
		.functions = 
		{ 
			NULL,
			NULL, 
			(ECSFunction)component_animation_color_change_tick,
			NULL
		}
	},
	.type = ECS_COMPONENT_ANIMATION_COLOR_CHANGE,
	.size = sizeof(ComponentAnimationColorChange)
};
