engine/include/systems/custom_behaviour.h

27 lines
600 B
C
Raw Normal View History

2023-05-25 17:35:32 +00:00
#ifndef ENGINE_INCLUDE_CUSTOM_BEHAVIOUR_H_
#define ENGINE_INCLUDE_CUSTOM_BEHAVIOUR_H_
#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 {
class CustomBehaviourSystem : public System {
public:
CustomBehaviourSystem(Scene* scene);
~CustomBehaviourSystem();
2023-05-25 17:35:32 +00:00
void OnUpdate(float ts) override;
2023-09-19 07:40:45 +00:00
void OnComponentInsert(Entity entity) override;
2023-05-25 17:35:32 +00:00
private:
2023-09-19 07:40:45 +00:00
std::unordered_map<Entity, bool> entity_is_initialised_{};
};
2023-05-25 17:35:32 +00:00
} // namespace engine
#endif