Class Component
Defined in File Actor.hpp
Inheritance Relationships
Derived Type
public Cacao::Script(Class Script)
Class Documentation
-
class Component
An object attached to an Actor that performs tasks on its behalf.
Subclassed by Cacao::Script
Public Functions
-
bool IsEnabled() const
Check if the component is enabled.
This takes into account both if the component itself is enabled and its owning Actor is active
Note
This will return false if the owning Actor is inactive
-
inline void SetEnabled(bool state)
Activate or deactivate the component.
- Parameters:
state – The new activation state
-
inline ActorRef GetOwner() const
Get the owning actor of this component.
- Throws:
NonexistentValueException – If the actor no longer exists
- Returns:
A reference to the owning actor
Protected Functions
-
inline virtual void OnMount()
Runs when the component is first mounted on an Actor.
Note
All setup should be performed here, NOT in the constructor. Only when this function is called is the component properly configured.
-
inline virtual void OnDelete()
Runs when the component is deleted from an Actor.
Note
All teardown should be performed here, NOT in the destructor. After this function is called, the component may be in an invalid state.
-
inline virtual void OnEnable()
Runs when the component is enabled or when the owning Actor becomes active if the component was already enabled.
-
inline virtual void OnDisable()
Runs when the component is disabled or when the owning Actor becomes inactive if the component was already enabled.
Friends
- friend class Actor
-
bool IsEnabled() const