#pragma once

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

#include "../component_game_object.h"
#include "../animation/component_animation_levitate.h"
#include "../behavior/component_behavior_chase.h"
#include "../stat/component_level.h"
#include "../behavior/component_behavior_act_in_rectangle.h"

#define COMPONENT_BEHAVIOR_BOOMERANG_SOUND_TIMER_MAX 10

#define COMPONENT_BEHAVIOR_BOOMERANG_LEVEL_TIMER_MULTIPLIER 5
#define COMPONENT_BEHAVIOR_BOOMERANG_TIMER_MAX 30

typedef struct ComponentBehaviorBoomerang
{
	ECSComponent component;
	f32 angle;
	f32 speed;
	f32 initialSpeed;
	s32 timer;
	s32 timerMax;
	u32 targetID;
	u32 soundTimer;
	bool isBoomerang;
	bool isBegin;
} ComponentBehaviorBoomerang;

void component_behavior_boomerang_init
(
	ComponentBehaviorBoomerang* self, 
	ECS* ecs,
	f32 chaseSpeed,
	f32 initialSpeed,
	f32 speed,
	u32 timer, 
	u32 targetID
);

void component_behavior_boomerang_add(ComponentBehaviorBoomerang* self, ECS* ecs);
void component_behavior_boomerang_delete(ComponentBehaviorBoomerang* self, ECS* ecs);
void component_behavior_boomerang_tick(ComponentBehaviorBoomerang* self, ECS* ecs);

static const ECSComponentInfo COMPONENT_BEHAVIOR_BOOMERANG_INFO = 
{
	.system = 
	{
		.functions = 
		{ 
			(ECSFunction)component_behavior_boomerang_add,
			(ECSFunction)component_behavior_boomerang_delete,
			(ECSFunction)component_behavior_boomerang_tick,
			NULL
		}
	},
	.type = ECS_COMPONENT_BEHAVIOR_BOOMERANG,
	.size = sizeof(ComponentBehaviorBoomerang)
};


