#include "Enemy.h" #include #include #include #include "Behaviour.h" #include "Generator.h" #include "NullBehaviour.h" #include "NullGenerator.h" Enemy::Enemy() : m_hold {0}, m_position {std::make_shared(Vector2{400.f, 300.f})}, m_generator {std::make_shared()}, m_behaviour {std::make_shared()} { } Enemy::Enemy( std::shared_ptr position, std::shared_ptr generator, std::shared_ptr behaviour) : m_hold {0}, m_position {position}, m_generator {generator}, m_behaviour {behaviour} { } void Enemy::update(const float dt) { if (m_hold > 0) { m_hold -= dt; return; } m_behaviour->update(dt); m_generator->update(dt); } void Enemy::draw() { if (m_hold > 0) return; DrawCircle(m_position->x, m_position->y, 6, DARKGRAY); } bool Enemy::gone() const { return m_position->y > 600; }