2020-07-03 18:31:17 +00:00
|
|
|
//
|
|
|
|
// Created by SeanOMik on 7/3/2020.
|
|
|
|
// Github: https://github.com/SeanOMik
|
|
|
|
// Email: seanomik@gmail.com
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef SIMPLEENGINE_ENTITY_EVENT_H
|
|
|
|
#define SIMPLEENGINE_ENTITY_EVENT_H
|
|
|
|
|
|
|
|
#include "../event.h"
|
|
|
|
#include "../entity.h"
|
|
|
|
|
|
|
|
namespace simpleengine {
|
|
|
|
class EntityEvent : public Event {
|
|
|
|
public:
|
2021-03-02 04:08:10 +00:00
|
|
|
explicit EntityEvent(sf::RenderWindow* window, std::shared_ptr<Entity> entity) : simpleengine::Event(window), entity(entity) {
|
2020-07-03 18:31:17 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Update(const float& delta_time) override {
|
|
|
|
entity->Update(delta_time);
|
2021-03-12 23:08:20 +00:00
|
|
|
|
|
|
|
if (entity->IsDestroying()) {
|
2021-11-20 05:06:50 +00:00
|
|
|
destroying = true;
|
2021-03-12 23:08:20 +00:00
|
|
|
}
|
2020-07-03 18:31:17 +00:00
|
|
|
}
|
|
|
|
|
2020-07-03 18:34:22 +00:00
|
|
|
void Render(sf::RenderTarget* target) override {
|
2020-07-03 18:31:17 +00:00
|
|
|
entity->Render(target);
|
|
|
|
}
|
2021-03-02 04:08:10 +00:00
|
|
|
|
|
|
|
std::shared_ptr<Entity> GetEntity() {
|
|
|
|
return entity;
|
|
|
|
}
|
2020-07-03 18:31:17 +00:00
|
|
|
private:
|
2021-03-02 04:08:10 +00:00
|
|
|
std::shared_ptr<Entity> entity;
|
2020-07-03 18:31:17 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //SIMPLEENGINE_ENTITY_EVENT_H
|