2024-03-31 10:11:22 +00:00
|
|
|
#pragma once
|
2023-05-25 17:35:32 +00:00
|
|
|
|
2023-08-01 15:13:33 +00:00
|
|
|
#include <unordered_map>
|
|
|
|
|
2023-09-19 07:40:45 +00:00
|
|
|
#include "ecs.h"
|
2023-05-25 17:35:32 +00:00
|
|
|
|
|
|
|
/* This system allows for one-off custom components that execute arbitrary code
|
|
|
|
* It is similar to Unity's 'MonoBehavior' system */
|
|
|
|
|
|
|
|
namespace engine {
|
|
|
|
|
2023-08-01 15:13:33 +00:00
|
|
|
class CustomBehaviourSystem : public System {
|
2024-07-29 17:58:33 +00:00
|
|
|
private:
|
|
|
|
std::unordered_map<Entity, bool> m_entity_is_initialised{};
|
|
|
|
|
|
|
|
public:
|
2024-03-31 10:11:22 +00:00
|
|
|
CustomBehaviourSystem(Scene* scene);
|
2024-07-29 17:58:33 +00:00
|
|
|
|
2024-03-31 10:11:22 +00:00
|
|
|
~CustomBehaviourSystem();
|
2023-05-25 17:35:32 +00:00
|
|
|
|
2024-06-04 18:01:49 +00:00
|
|
|
void onUpdate(float ts) override;
|
|
|
|
void onComponentInsert(Entity entity) override;
|
2023-08-01 15:13:33 +00:00
|
|
|
};
|
2023-05-25 17:35:32 +00:00
|
|
|
|
2024-03-31 10:11:22 +00:00
|
|
|
} // namespace engine
|