|
Vulkan Schnee 0.0.1
High-performance rendering engine
|
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>
Public Member Functions | |
| Logic (Entities::Scene *owningScene) | |
| Logic (const Entities::SpawnContext &context) | |
| virtual | ~Logic ()=default |
| virtual std::string | getComponentName () const |
| Gets the component type name for debugging/UI. | |
| virtual bool | drawImGui () |
| Draws component-specific ImGui inspector controls. | |
| virtual bool | drawImGuiName () |
| Used to alter the name of the entity in the outliner. | |
| 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 Public Attributes | |
| 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. | |
Protected Member Functions | |
| Entities::Scene * | getScene () const |
| Gets the scene this component belongs to. | |
| Core::SceneManager * | getSceneManager () const |
| Helper to get the SceneManager from the owning scene. | |
Private Member Functions | |
| void | setOwningEntity (Entities::Entity *entity) |
| Sets the owning entity. Called by Entity::addComponent(). | |
Private Attributes | |
| Entities::Scene * | scene_ = nullptr |
| Entities::Entity * | owningEntity_ = nullptr |
| bool | tickEnabled = false |
| bool | hasBegunPlay_ = false |
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 24 of file LogicComponent.h.
|
explicit |
Referenced by Engine::Components::Mesh::ownsCollisionChild().
|
explicit |
|
virtualdefault |
|
virtual |
Called when the component is added to the scene or the game starts.
Reimplemented in Engine::Components::Camera, Engine::Components::Collision, Engine::Components::DirectionalLight, Engine::Components::Mesh, Engine::Components::PhysicsBody, Engine::Components::VrGlider, Engine::Components::VrMovement, and Engine::Components::WindTrail.
|
nodiscard |
Checks if the component is currently set to tick.
|
virtual |
Draws component-specific ImGui inspector controls.
Reimplemented in Engine::Components::Camera, Engine::Components::Collision, Engine::Components::Mesh, Engine::Components::PhysicsBody, and Engine::Components::VrGlider.
|
virtual |
Used to alter the name of the entity in the outliner.
|
virtual |
Called when the component is removed or the game ends.
Reimplemented in Engine::Components::Camera, Engine::Components::CollidableMesh, Engine::Components::Collision, Engine::Components::DirectionalLight, Engine::Components::Mesh, Engine::Components::PhysicsBody, Engine::Components::VrGlider, Engine::Components::VrMovement, and Engine::Components::WindTrail.
|
nodiscardvirtual |
Gets the component type name for debugging/UI.
Reimplemented in Engine::Components::DirectionalLight, Engine::Components::VrGlider, and Engine::Components::WidgetComponent.
|
nodiscard |
Gets the entity this component belongs to.
|
nodiscardprotected |
Gets the scene this component belongs to.
|
nodiscardprotected |
Helper to get the SceneManager from the owning scene.
|
nodiscard |
| void Engine::Components::Logic::setCanTick | ( | bool | enable | ) |
Enables or disables ticking for this component.
| enable | True to enable ticking, false to disable. |
|
private |
Sets the owning entity. Called by Entity::addComponent().
| entity | Pointer to the owning entity. |
|
virtual |
Called every frame if ticking is enabled.
| deltaTime | Time elapsed since last frame. |
Reimplemented in Engine::Components::Camera, Engine::Components::VrCamera, Engine::Components::VrGlider, and Engine::Components::VrMovement.
|
staticconstexpr |
Fallback component type name. Derived classes may override getComponentName() for custom labels.
Definition at line 38 of file LogicComponent.h.
|
private |
Definition at line 123 of file LogicComponent.h.
|
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 32 of file LogicComponent.h.
|
private |
Definition at line 121 of file LogicComponent.h.
|
private |
Definition at line 120 of file LogicComponent.h.
|
private |
Definition at line 122 of file LogicComponent.h.