#include "entity_custarpedo.h"

/* Initializes a Custarpedo entity. */
void
entity_custarpedo_init(ECS* ecs, u32 id, vec3 position, u32 targetID, u32 level, Vector* entityList)
{
	ComponentEnemy* enemy;
	ComponentBehaviorChase* behaviorChase;
	ComponentGameObject* gameObject;

	behaviorChase = ecs_component_add(ecs, ECS_COMPONENT_BEHAVIOR_CHASE, id);
	enemy = ecs_component_add(ecs, ECS_COMPONENT_ENEMY, id);
	gameObject = ecs_component_get(ecs, ECS_COMPONENT_GAME_OBJECT, id);

	component_enemy_init
	(
		enemy,
		ecs,
		ecs->game->resources.textures[TEXTURE_CUSTARPEDO],
		(s32*)CUSTARPEDO_FRAME_SIZE,
		(s32*)CUSTARPEDO_ATLAS_SIZE,
		(f32*)CUSTARPEDO_SIZE,
		(f32*)CUSTARPEDO_PHYSICS_SIZE,
		position,
		CUSTARPEDO_FRICTION,
		CUSTARPEDO_VELOCITY_MAX,
		CUSTARPEDO_HEALTH_MAX,
		CUSTARPEDO_IS_BOUNCE,
		CUSTARPEDO_IS_AFFECTED_BY_GRAVITY,
		CUSTARPEDO_IS_SOLID,
		CUSTARPEDO_GOODIE_COUNT,
		level,
		entityList
	);

	component_behavior_chase_init
	(
		behaviorChase,
		CUSTARPEDO_BEHAVIOR_CHASE_SPEED,
		targetID
	);

	gameObject->height = CUSTARPEDO_HEIGHT;

	ComponentGameEntityType* gameEntityType; 
	gameEntityType = ecs_component_add(ecs, ECS_COMPONENT_GAME_ENTITY_TYPE, id); 

	component_game_entity_type_init 
	( 
		gameEntityType, 
		GAME_ENTITY_CUSTARPEDO 
	);
}
