KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
ActorComponent.h
Go to the documentation of this file.
1
10#pragma once
11
12#include "Karma/Core/Object.h"
13#include "Core/KarmaTypes.h"
14
15class AActor;
16
17namespace Karma
18{
33
48
61 {
63
64 private:
66 mutable AActor* m_OwnerPrivate;
67
69 uint8_t m_bHasBegunPlay : 1;
70
72 uint8_t m_bHasBeenCreated : 1;
73
75 uint8_t m_bIsActive : 1;
76
78 uint8_t m_bHasBeenInitialized : 1;
79
84 UWorld* m_WorldPrivate;
85
86 public:
93
104 virtual void TickComponent(float deltaTime);//, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction);
105
115 virtual void BeginPlay();
116
124 virtual void EndPlay(const EEndPlayReason::Type EndPlayReason);
125
131 AActor* GetOwner() const;
132
139 void SetOwner(AActor* NewOwner);
140
146 bool HasBeenCreated() const { return m_bHasBeenCreated; }
147
153 virtual void OnComponentCreated();
154
160 inline bool IsRegistered() const { return m_bRegistered; }
161
168
175 bool IsActive() const { return m_bIsActive; }
176
183 virtual void Activate(bool bReset = false);
184
192 void SetActiveFlag(const bool bNewIsActive);
193
199 bool HasBeenInitialized() const { return m_bHasBeenInitialized; }
200
208 virtual void InitializeComponent();
209
215 bool HasBegunPlay() const { return m_bHasBegunPlay; }
216
217 //~ Begin UObject Interface.
223 virtual void BeginDestroy() override;
224 //~ End UObject Interface.
225
231 virtual void UninitializeComponent();
232
238 virtual void OnComponentDestroyed(bool bDestroyingHierarchy);
239
240 public:
243
245 uint8_t m_bAutoActivate : 1;
246
247
250
251 protected:
255 uint8_t m_bRegistered : 1;
256
257 protected:
259 virtual bool ShouldActivate() const;
260 };
261}
EUpdateTransformFlags
Information about how to update transform when something is moved.
Definition ActorComponent.h:38
@ None
Definition ActorComponent.h:40
@ PropagateFromParent
Definition ActorComponent.h:44
@ OnlyUpdateIfUsingSocket
Definition ActorComponent.h:46
@ SkipPhysicsUpdate
Definition ActorComponent.h:42
EComponentCreationMethod
Enum for UActorComponent instance creation method.
Definition ActorComponent.h:23
@ UserConstructionScript
Definition ActorComponent.h:29
@ SimpleConstructionScript
Definition ActorComponent.h:27
@ Instance
Definition ActorComponent.h:31
#define KARMA_API
Defining Karma's API macro for storage class information.
Definition Core.h:41
@ None
Events of the unknown category.
Definition Event.h:35
#define DECLARE_KARMA_CLASS(TClass, TSuperClass)
Karma's gamecode object class declaration.
Definition GFrameworkMacros.h:45
This file contains the custom types used in Engine's logic.
ETeleportType
Definition KarmaTypes.h:682
@ None
Definition KarmaTypes.h:684
This file contains the class UObject along with helper functions.
@ Native
Native (UClass only).
Definition UObjectGlobals.h:251
signed int int32
32-bit signed integer
Definition UObjectGlobals.h:33
Actor is the base class for an object that can be placed or spawned in a level.
Definition Actor.h:35
bool HasBeenInitialized() const
Indicates that InitializeComponent has been called, but UninitializeComponent has not yet.
Definition ActorComponent.h:199
virtual bool ShouldActivate() const
Definition ActorComponent.cpp:86
bool IsActive() const
Returns whether the component is active or not.
Definition ActorComponent.h:175
AActor * GetOwner() const
Follow the Outer chain to get the AActor that 'Owns' this component.
Definition ActorComponent.cpp:58
virtual void UpdateComponentToWorld(EUpdateTransformFlags UpdateTransformFlags=EUpdateTransformFlags::None, ETeleportType Teleport=ETeleportType::None)
Recalculate the value of our component to world transform.
Definition ActorComponent.h:167
EComponentCreationMethod m_CreationMethod
Definition ActorComponent.h:242
bool HasBeenCreated() const
Indicates that OnCreatedComponent has been called, but OnDestroyedComponent has not yet.
Definition ActorComponent.h:146
void SetOwner(AActor *NewOwner)
Sets the owner of this component.
Definition ActorComponent.cpp:64
UActorComponent()
A constructor.
Definition ActorComponent.cpp:8
virtual void TickComponent(float deltaTime)
Function called every frame on this ActorComponent. Override this function to implement custom logic ...
Definition ActorComponent.cpp:13
uint8_t m_bWantsInitializeComponent
Definition ActorComponent.h:249
uint8_t m_bRegistered
Definition ActorComponent.h:255
uint8_t m_bAutoActivate
Definition ActorComponent.h:245
virtual void BeginPlay()
Begins Play for the component. Called when the owning Actor begins play or when the component is crea...
Definition ActorComponent.cpp:26
bool HasBegunPlay() const
Indicates that BeginPlay has been called, but EndPlay has not yet.
Definition ActorComponent.h:215
bool IsRegistered() const
See if this component is currently registered.
Definition ActorComponent.h:160
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason)
Ends gameplay for this component. //Called from AActor::EndPlay only if bHasBegunPlay is true// <- no...
Definition ActorComponent.cpp:38
UObject()
Definition Object.cpp:10
The World is the top level object representing a map or a sandbox in which Actors and Components will...
Definition World.h:148
Type
Definition KarmaTypes.h:33