Plasma Engine  2.0
Loading...
Searching...
No Matches
Actor.h
1#pragma once
2
3#include <Core/ActorSystem/ActorPlugin.h>
4#include <Foundation/Types/UniquePtr.h>
5
6struct plActorImpl;
7
8class PL_CORE_DLL plActor : public plReflectedClass
9{
10 PL_ADD_DYNAMIC_REFLECTION(plActor, plReflectedClass);
11
12 PL_DISALLOW_COPY_AND_ASSIGN(plActor);
13
14public:
15 plActor(plStringView sActorName, const void* pCreatedBy);
16 ~plActor();
17
19 plStringView GetName() const;
20
22 const void* GetCreatedBy() const;
23
25 void AddPlugin(plUniquePtr<plActorPlugin>&& pPlugin);
26
28 plActorPlugin* GetPlugin(const plRTTI* pType) const;
29
31 template <typename Type>
32 Type* GetPlugin() const
33 {
34 return static_cast<Type*>(GetPlugin(plGetStaticRTTI<Type>()));
35 }
36
38 void DestroyPlugin(plActorPlugin* pPlugin);
39
41 void GetAllPlugins(plHybridArray<plActorPlugin*, 8>& out_allPlugins);
42
45 {
46 return m_State == State::QueuedForDestruction;
47 }
48
49protected:
50 void UpdateAllPlugins();
51
52
53protected: // directly touched by plActorManager
54 friend class plActorManager;
55
57 virtual void Activate();
58
62 virtual void Update();
63
64private: // directly touched by plActorManager
65 enum class State
66 {
67 New,
68 Active,
69 QueuedForDestruction
70 };
71
72 State m_State = State::New;
73
74private:
76};
Definition Actor.h:9
Type * GetPlugin() const
Templated overload of GetPlugin() that automatically casts to the desired class type.
Definition Actor.h:32
bool IsActorQueuedForDestruction() const
Checks whether the actor is queued for destruction at the end of the frame.
Definition Actor.h:44
Definition ActorManager.h:28
Definition ActorPlugin.h:9
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
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
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
A Unique ptr manages an object and destroys that object when it goes out of scope....
Definition UniquePtr.h:10