Class Component
Defined in File Actor.hpp
Inheritance Relationships
Base Type
public AstraReflectBase
Derived Types
public Cacao::AudioPlayer(Class AudioPlayer)public Cacao::MeshRenderer(Class MeshRenderer)public Cacao::Script(Class Script)
Class Documentation
-
class Component : public AstraReflectBase
An object attached to an Actor that performs tasks on its behalf.
Subclassed by Cacao::AudioPlayer, Cacao::MeshRenderer, 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
- inline ASTRASETUP (Component) protected
-
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 OnUnmount()
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 struct astra::CommonActions< Component >
- friend class Actor
-
bool IsEnabled() const