Component that hosts a Behavior.
More...
#include <behaviorscript.h>
Component that hosts a Behavior.
This class acts as a bridge between the Behavior system and the Component system, enabling Behaviors to be used as Components within the engine's architecture.
- Note
- Users typically do not interact with this class directly. Instead, they create custom Behaviors and attach them to GameObjects via Components.
- See also
- Behavior
Usage:
◆ BehaviorScript()
| BehaviorScript::BehaviorScript |
( |
std::unique_ptr< Behavior > |
behavior | ) |
|
◆ behavior()
◆ disable()
◆ enable()
◆ enabled()
| bool BehaviorScript::enabled |
( |
| ) |
const |
◆ on_attach()
| void BehaviorScript::on_attach |
( |
| ) |
|
|
overridevirtual |
◆ on_deserialize()
| virtual void BehaviorScript::on_deserialize |
( |
const std::vector< uint8_t > & |
, |
|
|
size_t & |
|
|
) |
| |
|
inlinevirtual |
Deserializes the component's state from a byte array.
- Parameters
-
| data | The byte array containing the serialized state. |
| offset | The current offset in the byte array from which to start reading. This offset will be updated as bytes are read. |
- Returns
- void
Reimplemented from Component.
◆ on_detach()
| void BehaviorScript::on_detach |
( |
| ) |
|
|
overridevirtual |
◆ on_serialize()
| virtual void BehaviorScript::on_serialize |
( |
std::vector< uint8_t > & |
| ) |
const |
|
inlinevirtual |
Serializes the component's state into a byte array.
- Parameters
-
| out | A vector to which the serialized bytes will be appended. |
- Returns
- A vector of bytes representing the serialized state of the component.
Reimplemented from Component.
◆ type_name()
| std::string BehaviorScript::type_name |
( |
| ) |
const |
|
overridevirtual |
Provides a consistent type name for the component.
- Returns
- A string representing the type name of the component. @CAUTION: All derived components must implement this method to ensure consistent serialization across different compilers and platforms.
Implements Component.
◆ update()
| void BehaviorScript::update |
( |
float |
dt | ) |
|
|
overridevirtual |
The documentation for this class was generated from the following file: