aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/BehaviorScript.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/api/BehaviorScript.h')
-rw-r--r--src/crepe/api/BehaviorScript.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/crepe/api/BehaviorScript.h b/src/crepe/api/BehaviorScript.h
index a49fc96..2982358 100644
--- a/src/crepe/api/BehaviorScript.h
+++ b/src/crepe/api/BehaviorScript.h
@@ -11,6 +11,13 @@ 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:
BehaviorScript(game_object_id_t id, ComponentManager & component_manager);
@@ -18,7 +25,7 @@ protected:
friend class ComponentManager;
public:
- virtual ~BehaviorScript() = default;
+ ~BehaviorScript() = default;
public:
/**
@@ -36,7 +43,9 @@ protected:
friend class ScriptSystem;
//! Flag to indicate if script->init() has been called already
bool initialized = false;
+ //! Script instance
std::unique_ptr<Script> script = nullptr;
+ //! Reference to component manager
ComponentManager & component_manager;
private: