blob: 4160a7208bc7bca0153a1f0d7e9c6ce9f1445c0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#pragma once
#include <memory>
#include "../Component.h"
namespace crepe {
class ScriptSystem;
class ComponentManager;
class Script;
/**
* \brief Script component
*
* This class acts as a (component) wrapper around an instance of (a class
* derivatived from) \c Script. \c BehaviorScript is the only ECS component
* that stores member function implementations as data.
*/
class BehaviorScript : public Component {
protected:
friend class crepe::ComponentManager;
using Component::Component;
public:
~BehaviorScript() = default;
public:
template <class T>
BehaviorScript & set_script();
protected:
friend class crepe::ScriptSystem;
//! Script instance
std::unique_ptr<Script> script = nullptr;
};
} // namespace crepe
#include "BehaviorScript.hpp"
|