#pragma once

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

#include "../component_physics.h"
#include "../action/component_action_shoot.h"
#include "component_behavior_chase.h"
#include "component_behavior_act_in_rectangle.h"

typedef struct ComponentBehaviorApproachAndShoot
{
	ECSComponent component;
	f32 speed;
	f32 distance;
	u32 timer;
	u32 timerMax;
	u32 targetID;
} ComponentBehaviorApproachAndShoot;

void
component_behavior_approach_and_shoot_init
(
	ComponentBehaviorApproachAndShoot* self, 
	ECS* ecs,
	ProjectileInit projectileInit,
	f32 speed,
	f32 projectileSpeed,
	f32 offset,
	f32 height,
	f32 distance,
	u32 timer,
	u32 targetID
);

void component_behavior_approach_and_shoot_add(ComponentBehaviorApproachAndShoot* self, ECS* ecs);
void component_behavior_approach_and_shoot_delete(ComponentBehaviorApproachAndShoot* self, ECS* ecs);
void component_behavior_approach_and_shoot_tick(ComponentBehaviorApproachAndShoot* self, ECS* ecs);

static const ECSComponentInfo COMPONENT_BEHAVIOR_APPROACH_AND_SHOOT_INFO = 
{
	.system = 
	{
		.functions = 
		{ 
			(ECSFunction)component_behavior_approach_and_shoot_add,
			(ECSFunction)component_behavior_approach_and_shoot_delete,
			(ECSFunction)component_behavior_approach_and_shoot_tick,
			NULL
		}
	},
	.type = ECS_COMPONENT_BEHAVIOR_APPROACH_AND_SHOOT,
	.size = sizeof(ComponentBehaviorApproachAndShoot)
};


