Base class for all logic components that can be attached to an actor. Provides access to the scene, tick functionality, and lifecycle events.
More...
#include <LogicComponent.h>
|
| | Logic (Entities::Scene *owningScene) |
| virtual | ~Logic ()=default |
| virtual std::string | getComponentName () const |
| | Gets the component type name for debugging/UI.
|
| virtual void | beginPlay () |
| | Called when the component is added to the scene or the game starts.
|
| virtual void | tick (double deltaTime) |
| | Called every frame if ticking is enabled.
|
| virtual void | endPlay () |
| | Called when the component is removed or the game ends.
|
| bool | hasBegunPlay () const |
| bool | canTick () const |
| | Checks if the component is currently set to tick.
|
| void | setCanTick (bool enable) |
| | Enables or disables ticking for this component.
|
| Entities::Entity * | getOwningEntity () const |
| | Gets the entity this component belongs to.
|
|
| static constexpr bool | IsUnique = false |
| | Defines whether multiple instances of this component can exist on the same entity. Defaults to false (multiple allowed). Override in derived classes with static constexpr bool IsUnique = true; if needed.
|
| static constexpr const char * | ComponentName = "Logic" |
| | Fallback component type name. Derived classes may override getComponentName() for custom labels.
|
Base class for all logic components that can be attached to an actor. Provides access to the scene, tick functionality, and lifecycle events.
Definition at line 22 of file LogicComponent.h.
◆ Logic()
◆ ~Logic()
| virtual Engine::Components::Logic::~Logic |
( |
| ) |
|
|
virtualdefault |
◆ beginPlay()
| virtual void Engine::Components::Logic::beginPlay |
( |
| ) |
|
|
virtual |
◆ canTick()
| bool Engine::Components::Logic::canTick |
( |
| ) |
const |
|
nodiscard |
Checks if the component is currently set to tick.
- Returns
- true if ticking is enabled.
◆ endPlay()
| virtual void Engine::Components::Logic::endPlay |
( |
| ) |
|
|
virtual |
◆ getComponentName()
| virtual std::string Engine::Components::Logic::getComponentName |
( |
| ) |
const |
|
nodiscardvirtual |
◆ getOwningEntity()
Gets the entity this component belongs to.
- Returns
- Pointer to the owning Entity.
◆ getScene()
Gets the scene this component belongs to.
- Returns
- Pointer to the owning Scene.
◆ getSceneManager()
Helper to get the SceneManager from the owning scene.
- Returns
- Pointer to the SceneManager.
◆ hasBegunPlay()
| bool Engine::Components::Logic::hasBegunPlay |
( |
| ) |
const |
|
nodiscard |
◆ setCanTick()
| void Engine::Components::Logic::setCanTick |
( |
bool | enable | ) |
|
Enables or disables ticking for this component.
- Parameters
-
| enable | True to enable ticking, false to disable. |
◆ setOwningEntity()
Sets the owning entity. Called by Entity::addComponent().
- Parameters
-
| entity | Pointer to the owning entity. |
◆ tick()
| virtual void Engine::Components::Logic::tick |
( |
double | deltaTime | ) |
|
|
virtual |
◆ ComponentName
| const char* Engine::Components::Logic::ComponentName = "Logic" |
|
staticconstexpr |
◆ hasBegunPlay_
| bool Engine::Components::Logic::hasBegunPlay_ = false |
|
private |
◆ IsUnique
| bool Engine::Components::Logic::IsUnique = false |
|
staticconstexpr |
Defines whether multiple instances of this component can exist on the same entity. Defaults to false (multiple allowed). Override in derived classes with static constexpr bool IsUnique = true; if needed.
Definition at line 27 of file LogicComponent.h.
◆ owningEntity_
◆ scene_
◆ tickEnabled
| bool Engine::Components::Logic::tickEnabled = false |
|
private |
The documentation for this class was generated from the following file:
- /home/magerbeton/Documents/gl3-vulkan/Engine/include/Engine/Component/LogicComponent.h