5#include <Core/World/Declarations.h>
6#include <Foundation/Reflection/Reflection.h>
43 void SetActiveFlag(
bool bEnabled);
48 bool GetActiveFlag()
const;
57 bool IsActive()
const;
62 bool IsActiveAndInitialized()
const;
67 bool IsActiveAndSimulating()
const;
85 const plWorld* GetWorld()
const;
92 plUInt32 GetUniqueID()
const;
95 void SetUniqueID(plUInt32 uiUniqueID);
99 virtual void SerializeComponent(
plWorldWriter& inout_stream)
const;
105 virtual void DeserializeComponent(
plWorldReader& inout_stream);
109 void EnsureInitialized();
113 void EnsureSimulationStarted();
118 PL_ALWAYS_INLINE
bool SendMessage(
plMessage& ref_msg)
const {
return SendMessageInternal(ref_msg,
false); }
124 virtual bool HandlesMessage(
const plMessage& msg)
const;
127 void SetUserFlag(plUInt8 uiFlagIndex,
bool bSet);
130 bool GetUserFlag(plUInt8 uiFlagIndex)
const;
144 bool IsDynamic()
const;
146 virtual plWorldModuleTypeId GetTypeId()
const = 0;
147 virtual plComponentMode::Enum GetMode()
const = 0;
158 virtual void Initialize();
168 virtual void Deinitialize();
177 virtual void OnActivated();
185 virtual void OnDeactivated();
205 virtual void OnSimulationStarted();
208 void EnableUnhandledMessageHandler(
bool enable);
213 virtual bool OnUnhandledMessage(
plMessage& msg,
bool bWasPostedMsg);
218 virtual bool OnUnhandledMessage(
plMessage& msg,
bool bWasPostedMsg)
const;
222 const plRTTI* m_pMessageDispatchType =
nullptr;
224 bool IsInitialized()
const;
225 bool IsInitializing()
const;
226 bool IsSimulationStarted()
const;
230 void UpdateActiveState(
bool bOwnerActive);
233 plWorld* Reflection_GetWorld()
const;
234 void Reflection_Update(
plTime deltaTime);
236 bool SendMessageInternal(
plMessage& msg,
bool bWasPostedMsg);
237 bool SendMessageInternal(
plMessage& msg,
bool bWasPostedMsg)
const;
241 plUInt32 m_uiUniqueID = plInvalidIndex;
246 static plWorldModuleTypeId s_TypeId;
264#include <Core/World/Implementation/Component_inl.h>
Base class of all component types.
Definition Component.h:25
bool WasCreatedByPrefab() const
Checks whether the plObjectFlags::CreatedByPrefab flag is set on this component.
Definition Component.h:136
PL_ALWAYS_INLINE bool SendMessage(plMessage &ref_msg)
Sends a message to this component.
Definition Component.h:117
void SetCreatedByPrefab()
Adds plObjectFlags::CreatedByPrefab to the component. See the flag for details.
Definition Component.h:133
plComponent()
Keep the constructor private or protected in derived classes, so it cannot be called manually.
Base class for all component managers. Do not derive directly from this class, but derive from plComp...
Definition ComponentManager.h:21
This class represents an object inside the world.
Definition GameObject.h:32
Base class for all message types. Each message type has it's own id which is used to dispatch message...
Definition Message.h:22
This class holds information about reflected types. Each instance represents one type that is known t...
Definition RTTI.h:30
All classes that should be dynamically reflectable, need to be derived from this base class.
Definition DynamicRTTI.h:86
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22
Reads a world description from a stream. Allows to instantiate that world multiple times in different...
Definition WorldReader.h:47
Stores an entire plWorld in a stream.
Definition WorldWriter.h:13
The plBitflags class allows you to work with type-safe bitflags.
Definition Bitflags.h:82
Definition Component.h:250
A handle to a component.
Definition Declarations.h:138
Internal component id used by plComponentHandle.
Definition Declarations.h:103
@ CreatedByPrefab
Such flagged objects and components are ignored during scene export (see plWorldWriter) and will be r...
Definition Declarations.h:191
@ ActiveFlag
The object/component has the 'active flag' set.
Definition Declarations.h:178
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
PL_ALWAYS_INLINE static constexpr plTime MakeZero()
Creates an instance of plTime that was initialized with zero.
Definition Time.h:42