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 "krpch.h"
13
14#include "Karma/Core/Object.h"
15
16class AActor;
17
18namespace Karma
19{
34
47 {
49
50 private:
52 mutable AActor* m_OwnerPrivate;
53
55 uint8_t m_bHasBegunPlay : 1;
56
58 uint8_t m_bHasBeenCreated : 1;
59
61 uint8_t m_bIsActive : 1;
62
64 uint8_t m_bHasBeenInitialized : 1;
65
70 UWorld* m_WorldPrivate;
71
72 public:
79
90 virtual void TickComponent(float deltaTime);//, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction);
91
101 virtual void BeginPlay();
102
110 virtual void EndPlay(const EEndPlayReason::Type EndPlayReason);
111
117 AActor* GetOwner() const;
118
124 bool HasBeenCreated() const { return m_bHasBeenCreated; }
125
131 virtual void OnComponentCreated();
132
138 inline bool IsRegistered() const { return m_bRegistered; }
139
146 bool IsActive() const { return m_bIsActive; }
147
154 virtual void Activate(bool bReset = false);
155
163 void SetActiveFlag(const bool bNewIsActive);
164
170 bool HasBeenInitialized() const { return m_bHasBeenInitialized; }
171
179 virtual void InitializeComponent();
180
186 bool HasBegunPlay() const { return m_bHasBegunPlay; }
187
188 //~ Begin UObject Interface.
194 virtual void BeginDestroy() override;
195 //~ End UObject Interface.
196
202 virtual void UninitializeComponent();
203
209 virtual void OnComponentDestroyed(bool bDestroyingHierarchy);
210
211 public:
214
216 uint8_t m_bAutoActivate : 1;
217
218
221
222 protected:
226 uint8_t m_bRegistered : 1;
227
228 protected:
230 virtual bool ShouldActivate() const;
231 };
232}
EComponentCreationMethod
Enum for UActorComponent instance creation method.
Definition ActorComponent.h:24
@ UserConstructionScript
Definition ActorComponent.h:30
@ SimpleConstructionScript
Definition ActorComponent.h:28
@ Instance
Definition ActorComponent.h:32
#define KARMA_API
Defining Karma's API macro for storage class information.
Definition Core.h:41
#define DECLARE_KARMA_CLASS(TClass, TSuperClass)
Karma's gamecode object class declaration.
Definition GFrameworkMacros.h:44
This file contains the class UObject along with helper functions.
@ Native
Native (UClass only).
Definition UObjectGlobals.h:251
Actor is the base class for an object that can be placed or spawned in a level.
Definition Actor.h:34
bool HasBeenInitialized() const
Indicates that InitializeComponent has been called, but UninitializeComponent has not yet.
Definition ActorComponent.h:170
virtual bool ShouldActivate() const
Definition ActorComponent.cpp:81
bool IsActive() const
Returns whether the component is active or not.
Definition ActorComponent.h:146
AActor * GetOwner() const
Follow the Outer chain to get the AActor that 'Owns' this component.
Definition ActorComponent.cpp:58
EComponentCreationMethod m_CreationMethod
Definition ActorComponent.h:213
bool HasBeenCreated() const
Indicates that OnCreatedComponent has been called, but OnDestroyedComponent has not yet.
Definition ActorComponent.h:124
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:220
uint8_t m_bRegistered
Definition ActorComponent.h:226
uint8_t m_bAutoActivate
Definition ActorComponent.h:216
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:186
bool IsRegistered() const
See if this component is currently registered.
Definition ActorComponent.h:138
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:150
Type
Definition KarmaTypes.h:23