Karma Engine
Loading...
Searching...
No Matches
Karma::UActorComponent Class Reference

#include <ActorComponent.h>

Inheritance diagram for Karma::UActorComponent:
Collaboration diagram for Karma::UActorComponent:

Public Member Functions

virtual void TickComponent (float deltaTime)
 
virtual void BeginPlay ()
 
virtual void EndPlay (const EEndPlayReason::Type EndPlayReason)
 
AActorGetOwner () const
 
bool HasBeenCreated () const
 
virtual void OnComponentCreated ()
 
bool IsRegistered () const
 
bool IsActive () const
 
virtual void Activate (bool bReset=false)
 
void SetActiveFlag (const bool bNewIsActive)
 
bool HasBeenInitialized () const
 
virtual void InitializeComponent ()
 
bool HasBegunPlay () const
 
virtual void BeginDestroy () override
 Called before destroying the object. This is called immediately upon deciding to destroy the object, to allow the object to begin an asynchronous cleanup process.
 
virtual void UninitializeComponent ()
 
virtual void OnComponentDestroyed (bool bDestroyingHierarchy)
 
- Public Member Functions inherited from Karma::UObject
 UObject ()
 
virtual void FinishDestroy ()
 
virtual const std::string & GetDesc ()
 Return a one line description of an object for viewing in the thumbnail view of the generic browser.
 
virtual class UWorldGetWorld () const
 Returns what UWorld this object is contained within.
 
bool IsValidChecked (const UObject *Test)
 
FORCEINLINE bool Modify (bool bAlwaysMarkDirty=true)
 
bool IsSelected () const
 Test the selection state of a UObject.
 
- Public Member Functions inherited from Karma::UObjectBase
 UObjectBase (UClass *inClass, EObjectFlags inFlags, EInternalObjectFlags inInternalFlags, UObject *inOuter, const std::string &inName)
 
UPackageGetPackage () const
 
UPackageGetExternalPackage () const
 
bool IsUnreachable () const
 
FORCEINLINE void SetInternalIndex (uint32_t StoreIndex)
 
FORCEINLINE uint32_t GetInterIndex () const
 
void MarkAsGarbage ()
 
void ClearGarbage ()
 
FORCEINLINE const std::string & GetName () const
 
FORCEINLINE void SetObjectName (const std::string &aName)
 
FORCEINLINE UObjectGetOuter () const
 
UObjectGetTypedOuter (UClass *Target) const
 
template<typename T >
T * GetTypedOuter () const
 
bool IsValidLowLevel () const
 
template<typename OtherClassType >
FORCEINLINE bool IsA (OtherClassType SomeBase) const
 
FORCEINLINE UClassGetClass () const
 
FORCEINLINE EObjectFlags GetFlags () const
 
FORCEINLINE void SetFlags (EObjectFlags NewFlags)
 
FORCEINLINE void ClearFlags (EObjectFlags NewFlags)
 
FORCEINLINE bool HasAnyFlags (EObjectFlags FlagsToCheck) const
 
FORCEINLINE bool HasAnyInternalFlags (EInternalObjectFlags FlagsToCheck) const
 
FORCEINLINE void SetInternalFlags (EInternalObjectFlags FlagsToSet) const
 
FORCEINLINE void AddToRoot ()
 

Public Attributes

EComponentCreationMethod m_CreationMethod
 
uint8_t m_bAutoActivate: 1
 
uint8_t m_bWantsInitializeComponent: 1
 

Protected Member Functions

virtual bool ShouldActivate () const
 
- Protected Member Functions inherited from Karma::UObjectBase
FORCEINLINE void SetFlagsTo (EObjectFlags NewFlags)
 

Protected Attributes

uint8_t m_bRegistered: 1
 

Additional Inherited Members

- Static Public Member Functions inherited from Karma::UObject
static const char * StaticConfigName ()
 
- Static Public Member Functions inherited from Karma::UObjectBase
static FORCEINLINE EInternalObjectFlags FixGarbageOrPendingKillInternalObjectFlags (const EInternalObjectFlags InFlags)
 

Detailed Description

ActorComponent is the base class for components that define reusable behavior that can be added to different types of Actors. ActorComponents that have a transform are known as SceneComponents and those that can be rendered are PrimitiveComponents. Components are a special type of Object that Actors can attach to themselves as sub-objects. Components are useful for sharing common behaviors

See also
ActorComponent
https://docs.unrealengine.com/5.2/en-US/components-in-unreal-engine/
USceneComponent
UPrimitiveComponent

Member Function Documentation

◆ Activate()

void Karma::UActorComponent::Activate ( bool bReset = false)
virtual

Activates the SceneComponent, should be overridden by native child classes.

Parameters
bReset- Whether the activation should happen even if ShouldActivate returns false.

◆ BeginDestroy()

void Karma::UActorComponent::BeginDestroy ( )
overridevirtual

Called before destroying the object. This is called immediately upon deciding to destroy the object, to allow the object to begin an asynchronous cleanup process.

Todo
To be written with Shiva logic for UObject destruction.
Since
Karma 1.0.0

Reimplemented from Karma::UObject.

Reimplemented in Karma::UChildActorComponent, and Karma::USceneComponent.

◆ BeginPlay()

void Karma::UActorComponent::BeginPlay ( )
virtual

Begins Play for the component. Called when the owning Actor begins play or when the component is created if the Actor has already begun play. Actor BeginPlay normally happens right after PostInitializeComponents but can be delayed for networked or child actors. Requires component to be registered and initialized.

Reimplemented in Karma::UPrimitiveComponent.

◆ EndPlay()

void Karma::UActorComponent::EndPlay ( const EEndPlayReason::Type EndPlayReason)
virtual

Ends gameplay for this component. Called from AActor::EndPlay only if bHasBegunPlay is true

◆ GetOwner()

AActor * Karma::UActorComponent::GetOwner ( ) const

Follow the Outer chain to get the AActor that 'Owns' this component

◆ HasBeenCreated()

bool Karma::UActorComponent::HasBeenCreated ( ) const
inline

Indicates that OnCreatedComponent has been called, but OnDestroyedComponent has not yet

◆ HasBeenInitialized()

bool Karma::UActorComponent::HasBeenInitialized ( ) const
inline

Indicates that InitializeComponent has been called, but UninitializeComponent has not yet

◆ HasBegunPlay()

bool Karma::UActorComponent::HasBegunPlay ( ) const
inline

Indicates that BeginPlay has been called, but EndPlay has not yet

◆ InitializeComponent()

void Karma::UActorComponent::InitializeComponent ( )
virtual

Initializes the component. Occurs at level startup or actor spawn. This is before BeginPlay (Actor or Component). All Components in the level will be Initialized on load before any Actor/Component gets BeginPlay Requires component to be registered, and bWantsInitializeComponent to be true.

◆ IsActive()

bool Karma::UActorComponent::IsActive ( ) const
inline

Returns whether the component is active or not

Returns
- The active state of the component.

◆ IsRegistered()

bool Karma::UActorComponent::IsRegistered ( ) const
inline

See if this component is currently registered

◆ OnComponentCreated()

void Karma::UActorComponent::OnComponentCreated ( )
virtual

Called when a component is created (not loaded). This can happen in the editor or during gameplay

◆ OnComponentDestroyed()

void Karma::UActorComponent::OnComponentDestroyed ( bool bDestroyingHierarchy)
virtual

Called when a component is destroyed

Parameters
bDestroyingHierarchy- True if the entire component hierarchy is being torn down, allows avoiding expensive operations

◆ SetActiveFlag()

void Karma::UActorComponent::SetActiveFlag ( const bool bNewIsActive)

Sets the value of bIsActive without causing other side effects to this instance.

Activate, Deactivate, and SetActive are preferred in most cases because they respect virtual behavior.

◆ ShouldActivate()

bool Karma::UActorComponent::ShouldActivate ( ) const
protectedvirtual

Return true if this component is in a state where it can be activated normally.

◆ TickComponent()

void Karma::UActorComponent::TickComponent ( float deltaTime)
virtual

Function called every frame on this ActorComponent. Override this function to implement custom logic to be executed every frame. Only executes if the component is registered, and also PrimaryComponentTick.bCanEverTick must be set to true.

Parameters
deltaTime- The time since the last tick. Rest of the params shall be functionla later
TickType- The kind of tick this is, for example, are we paused, or 'simulating' in the editor
ThisTickFunction- Internal tick function struct that caused this to run

◆ UninitializeComponent()

void Karma::UActorComponent::UninitializeComponent ( )
virtual

Handle this component being Uninitialized.

See also
Called from AActor::EndPlay only if bHasBeenInitialized is true

Member Data Documentation

◆ m_bAutoActivate

uint8_t Karma::UActorComponent::m_bAutoActivate

Whether the component is activated at creation or must be explicitly activated.

◆ m_bRegistered

uint8_t Karma::UActorComponent::m_bRegistered
protected

Indicates if this ActorComponent is currently registered with a scene.

◆ m_bWantsInitializeComponent

uint8_t Karma::UActorComponent::m_bWantsInitializeComponent

If true, we call the virtual InitializeComponent

◆ m_CreationMethod

EComponentCreationMethod Karma::UActorComponent::m_CreationMethod

Describes how a component instance will be created


The documentation for this class was generated from the following files: