Karma Engine
Loading...
Searching...
No Matches
ActorComponent.h
1#pragma once
2
3#include "krpch.h"
4
5#include "Karma/Core/Object.h"
6
7class AActor;
8
9namespace Karma
10{
11 enum class EComponentCreationMethod : uint8_t
12 {
14 Native,
16 SimpleConstructionScript,
18 UserConstructionScript,
20 Instance,
21 };
22
34 class KARMA_API UActorComponent : public UObject
35 {
36 DECLARE_KARMA_CLASS(UActorComponent, UObject)
37
38 private:
40 mutable AActor* m_OwnerPrivate;
41
43 uint8_t m_bHasBegunPlay : 1;
44
46 uint8_t m_bHasBeenCreated : 1;
47
49 uint8_t m_bIsActive : 1;
50
52 uint8_t m_bHasBeenInitialized : 1;
53
58 UWorld* m_WorldPrivate;
59
60 public:
62
72 virtual void TickComponent(float deltaTime);//, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction);
73
80 virtual void BeginPlay();
81
86 virtual void EndPlay(const EEndPlayReason::Type EndPlayReason);
87
89 AActor* GetOwner() const;
90
92 bool HasBeenCreated() const { return m_bHasBeenCreated; }
93
95 virtual void OnComponentCreated();
96
98 inline bool IsRegistered() const { return m_bRegistered; }
99
104 bool IsActive() const { return m_bIsActive; }
105
110 virtual void Activate(bool bReset = false);
111
117 void SetActiveFlag(const bool bNewIsActive);
118
120 bool HasBeenInitialized() const { return m_bHasBeenInitialized; }
121
127 virtual void InitializeComponent();
128
132 bool HasBegunPlay() const { return m_bHasBegunPlay; }
133
134 //~ Begin UObject Interface.
135 virtual void BeginDestroy() override;
136 //~ End UObject Interface.
137
143 virtual void UninitializeComponent();
144
150 virtual void OnComponentDestroyed(bool bDestroyingHierarchy);
151
152 public:
154 EComponentCreationMethod m_CreationMethod;
155
157 uint8_t m_bAutoActivate : 1;
158
159
162
163 protected:
167 uint8_t m_bRegistered : 1;
168
169 protected:
171 virtual bool ShouldActivate() const;
172 };
173}
This file contains the class UObject along with helper functions.
Definition Actor.h:22
Definition ActorComponent.h:35
bool HasBeenInitialized() const
Definition ActorComponent.h:120
bool IsActive() const
Definition ActorComponent.h:104
EComponentCreationMethod m_CreationMethod
Definition ActorComponent.h:154
bool HasBeenCreated() const
Definition ActorComponent.h:92
uint8_t m_bWantsInitializeComponent
Definition ActorComponent.h:161
uint8_t m_bRegistered
Definition ActorComponent.h:167
uint8_t m_bAutoActivate
Definition ActorComponent.h:157
bool HasBegunPlay() const
Definition ActorComponent.h:132
bool IsRegistered() const
Definition ActorComponent.h:98
The base class of all the game code relevant objects.
Definition Object.h:106
Definition World.h:108
Type
Definition KarmaTypes.h:13