3#include <Core/World/World.h>
4#include <Foundation/Communication/Message.h>
14 PL_ALWAYS_INLINE
void FillFromSenderComponent(
const plComponent* pSenderComponent)
16 if (pSenderComponent !=
nullptr)
18 m_hSenderComponent = pSenderComponent->
GetHandle();
37template <
typename EventMessageType>
41 PL_ALWAYS_INLINE
bool SendEventMessage(EventMessageType& inout_msg,
plComponent* pSenderComponent,
plGameObject* pSearchObject)
43 if constexpr (PL_IS_DERIVED_FROM_STATIC(
plEventMessage, EventMessageType))
45 inout_msg.FillFromSenderComponent(pSenderComponent);
47 return plInternal::EventMessageSenderHelper::SendEventMessage(inout_msg, pSenderComponent, pSearchObject, m_CachedReceivers);
50 PL_ALWAYS_INLINE
bool SendEventMessage(EventMessageType& inout_msg,
const plComponent* pSenderComponent,
const plGameObject* pSearchObject)
const
52 if constexpr (PL_IS_DERIVED_FROM_STATIC(
plEventMessage, EventMessageType))
54 inout_msg.FillFromSenderComponent(pSenderComponent);
56 return plInternal::EventMessageSenderHelper::SendEventMessage(inout_msg, pSenderComponent, pSearchObject, m_CachedReceivers);
59 PL_ALWAYS_INLINE
void PostEventMessage(EventMessageType& ref_msg,
plComponent* pSenderComponent,
plGameObject* pSearchObject,
62 if constexpr (PL_IS_DERIVED_FROM_STATIC(
plEventMessage, EventMessageType))
64 ref_msg.FillFromSenderComponent(pSenderComponent);
66 plInternal::EventMessageSenderHelper::PostEventMessage(ref_msg, pSenderComponent, pSearchObject, m_CachedReceivers, delay, queueType);
69 PL_ALWAYS_INLINE
void PostEventMessage(EventMessageType& ref_msg,
const plComponent* pSenderComponent,
const plGameObject* pSearchObject,
72 if constexpr (PL_IS_DERIVED_FROM_STATIC(
plEventMessage, EventMessageType))
74 ref_msg.FillFromSenderComponent(pSenderComponent);
76 plInternal::EventMessageSenderHelper::PostEventMessage(ref_msg, pSenderComponent, pSearchObject, m_CachedReceivers, delay, queueType);
79 PL_ALWAYS_INLINE
void Invalidate()
81 m_CachedReceivers.
Clear();
82 m_CachedReceivers.GetUserData<plUInt32>() = 0;
Base class of all component types.
Definition Component.h:25
plComponentHandle GetHandle() const
Returns a handle to this component.
Definition Component_inl.h:53
plGameObject * GetOwner()
Returns the owner game object if the component is attached to one or nullptr.
Definition Component_inl.h:43
A message sender that sends all messages to the next component derived from plEventMessageHandlerComp...
Definition EventMessage.h:39
This class represents an object inside the world.
Definition GameObject.h:32
plGameObjectHandle GetHandle() const
Returns a handle to this object.
Definition GameObject_inl.h:64
Base class for all message types. Each message type has it's own id which is used to dispatch message...
Definition Message.h:22
void Clear()
Clears the array.
Definition SmallArray_inl.h:222
Definition SmallArray.h:219
A handle to a component.
Definition Declarations.h:138
Base class for all messages that are sent as 'events'.
Definition EventMessage.h:8
A handle to a game object.
Definition Declarations.h:76
Definition EventMessage.h:27
Base class for all message senders.
Definition Message.h:144
Enum
Definition Declarations.h:274
@ NextFrame
Process the message in the PreAsync phase of the next frame.
Definition Declarations.h:277
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12