8#ifndef CORI_MAX_TRIGGER_VISITORS
9 #define CORI_MAX_TRIGGER_VISITORS 4
14 namespace Components {
40 template<std::derived_from<TriggerBehaviour> Behavior>
42 m_Behavior = std::make_unique<Behavior>();
43 m_BehaviourType =
typeid(Behavior);
44 m_VisitorBuffer.clear();
45 return static_cast<Behavior*
>(m_Behavior.get());
53 template<std::derived_from<TriggerBehaviour> Behavior>
55 return m_BehaviourType == std::type_index(
typeid(Behavior));
63 template<std::derived_from<TriggerBehaviour> Behavior>
64 std::expected<Behavior*, Core::CoriError<std::type_index>>
GetBehavior() {
65 if (std::type_index(
typeid(Behavior)) != m_BehaviourType) {
69 return static_cast<Behavior*
>(m_Behavior.get());
76 void OnTickUpdate(
const float timeStep);
80 std::unique_ptr<TriggerBehaviour> m_Behavior{
nullptr };
81 std::type_index m_BehaviourType{
typeid(
nullptr) };
#define CORI_DEMANGLE(name)
#define CORI_CLEAN_TYPE_NAME(tn)
Custom error class mainly used in std::expected.
This is my packed/dense array custom implementation.
bool HasBehaviour() const
Checks if a specific behaviour is currently assigned to the trigger.
std::expected< Behavior *, Core::CoriError< std::type_index > > GetBehavior()
Retries the pointer to the active behaviour instance.
Behavior * SetBehavior()
Sets or changes the current Trigger behavior/script.
Entities are the essential part of WorldSystem.
System responsible for handling physical triggers.