#ifndef _H_BULLET_H
#define _H_BULLET_H

#include "gameplay/entity.h"
#include <glm/glm.hpp>
#include <vector>
class Component;
class Camera;

class Bullet : public Entity
{
public:
	Bullet
	(
		const unsigned int owner,
		std::shared_ptr<Shader> shader, 
		glm::vec3 fireFrom, 
		glm::vec2 direction, 
		float bulletSpeed, 
		float bulletDrop, 
		glm::vec2 bulletSize
	) :
		Entity(shader),
		origin(fireFrom),
		direction(direction),
		bulletSpeed(bulletSpeed),
		bulletDrop(bulletDrop),
		bulletSize(bulletSize) 
	{
		this->setPosition(origin);
		this->setScale(glm::vec3(bulletSize, 1.0f));
		ownerid = owner;
	};

	void addComponent(std::shared_ptr<Component> component);

	void update(float deltaTime) override;
	void render(const std::shared_ptr<Camera>& camera) override;

	float getBulletDrop() const { return bulletDrop; }
	glm::vec3 getBulletOrigin() const { return origin; }

	~Bullet();

private:
	unsigned int ownerid;
	glm::vec3 origin;
	glm::vec2 direction;
	float bulletSpeed;
	float bulletDrop;
	glm::vec2 bulletSize;
	std::vector<std::shared_ptr<Component>> components;
};

#endif // _H_BULLET_H