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

#include <Actor.h>

Inheritance diagram for Karma::AActor:
Collaboration diagram for Karma::AActor:

Public Member Functions

 AActor ()
 
ULevelGetLevel () const
 
void PostSpawnInitialize (FTransform const &SpawnTransform, AActor *InOwner, APawn *InInstigator, bool bRemoteOwned, bool bNoFail, bool bDeferConstruction)
 
virtual UWorldGetWorld () const override final
 
bool HasActorBegunPlay () const
 
bool IsActorBeginningPlay () const
 
void DispatchBeginPlay (bool bFromLevelStreaming=false)
 
virtual void SetOwner (AActor *NewOwner)
 
void FinishSpawning (const FTransform &Transform, bool bIsDefaultTransform=false)
 
bool IsOwnedBy (const AActor *TestOwner) const
 
void PostActorConstruction ()
 
void GetComponents (KarmaVector< USceneComponent * > &OutComponents) const
 
void GetComponents (KarmaVector< UActorComponent * > &OutComponents) const
 
void SetInstigator (APawn *InInstigator)
 
FORCEINLINE USceneComponentGetRootComponent () const
 
bool SetRootComponent (USceneComponent *NewRootComponent)
 
const FTransformGetTransform () const
 
const FTransformActorToWorld () const
 
void InitializeComponents ()
 
virtual void PostInitializeComponents ()
 
AActorGetParentActor () const
 
UChildActorComponentGetParentComponent () const
 
void RemoveOwnedComponent (std::shared_ptr< UActorComponent > Component)
 
bool GetAutoDestroyWhenFinished () const
 
bool CanTick () const
 
void DisableTick (bool bDisable)
 
virtual void Tick (float DeltaSeconds)
 
- 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.
 
bool IsValidChecked (const UObject *Test)
 
virtual void BeginDestroy ()
 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.
 
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 ()
 

Static Public Member Functions

static void DispatchOnComponentsCreated (AActor *NewActor)
 
static USceneComponentFixupNativeActorComponents (AActor *Actor)
 
- 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)
 

Public Attributes

float m_CreationTime
 
AActorm_Owner
 
KarmaVector< AActor * > m_Children
 

Protected Member Functions

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

Protected Attributes

USceneComponentm_RootComponent
 
bool m_bCanEverTick
 

Detailed Description

Actor is the base class for an Object that can be placed or spawned in a level. A concept taken from Unreal Engine. Actors may contain a collection of ActorComponents, which can be used to control how actors move, how they are rendered, etc.

Constructor & Destructor Documentation

◆ AActor()

Karma::AActor::AActor ( )

Default constructor for AActor

Member Function Documentation

◆ ActorToWorld()

const FTransform & Karma::AActor::ActorToWorld ( ) const
inline

Get the local-to-world transform of the RootComponent. Identical to GetTransform().

◆ BeginPlay()

void Karma::AActor::BeginPlay ( )
protectedvirtual

Overridable native event for when play begins for this actor.

◆ DispatchBeginPlay()

void Karma::AActor::DispatchBeginPlay ( bool bFromLevelStreaming = false)

Initiate a begin play call on this Actor, will handle calling in the correct order.

GetPathName()

◆ DispatchOnComponentsCreated()

void Karma::AActor::DispatchOnComponentsCreated ( AActor * NewActor)
static

Util to call OnComponentCreated on components

◆ FinishSpawning()

void Karma::AActor::FinishSpawning ( const FTransform & Transform,
bool bIsDefaultTransform = false )

Called to finish the spawning process, generally in the case of deferred spawning

◆ FixupNativeActorComponents()

USceneComponent * Karma::AActor::FixupNativeActorComponents ( AActor * Actor)
static

Util that sets up the actor's component hierarchy (when users forget to do so, in their native ctor)

◆ GetComponents()

void Karma::AActor::GetComponents ( KarmaVector< USceneComponent * > & OutComponents) const
inline

Get all components derived from class 'ComponentType' and fill in the OutComponents array with the result. It's recommended to use TArrays with a TInlineAllocator to potentially avoid memory allocation costs.

Parameters
bIncludeFromChildActorsIf true then recurse in to ChildActor components and find components of the appropriate type in those Actors as well

◆ GetLevel()

ULevel * Karma::AActor::GetLevel ( ) const

Return the ULevel that this Actor is part of.

◆ GetParentActor()

AActor * Karma::AActor::GetParentActor ( ) const

If this Actor was created by a Child Actor Component returns the Actor that owns that Child Actor Component

See also
AActor::PostActorConstruction()

◆ GetParentComponent()

UChildActorComponent * Karma::AActor::GetParentComponent ( ) const

If this Actor was created by a Child Actor Component returns that Child Actor Component

◆ GetRootComponent()

FORCEINLINE USceneComponent * Karma::AActor::GetRootComponent ( ) const
inline

Returns this actor's root component.

◆ GetTransform()

const FTransform & Karma::AActor::GetTransform ( ) const
inline

Get the actor-to-world transform.

Returns
The transform that transforms from actor space to world space.

◆ GetWorld()

UWorld * Karma::AActor::GetWorld ( ) const
finaloverridevirtual

Getter for the cached world pointer, will return null if the actor is not actually spawned in a level

Reimplemented from Karma::UObject.

◆ HasActorBegunPlay()

bool Karma::AActor::HasActorBegunPlay ( ) const
inline

Returns whether an actor has had BeginPlay called on it (and not subsequently had EndPlay called)

◆ InitializeComponents()

void Karma::AActor::InitializeComponents ( )

Iterate over components array and call InitializeComponent, which happens once per actor

See also
AActor::PostActorConstruction()

◆ IsActorBeginningPlay()

bool Karma::AActor::IsActorBeginningPlay ( ) const
inline

Returns whether an actor is in the process of beginning play

◆ IsOwnedBy()

bool Karma::AActor::IsOwnedBy ( const AActor * TestOwner) const
inline

See if this actor is owned by TestOwner.

See also
AActor::SetOwner(AActor* NewOwner)

◆ PostActorConstruction()

void Karma::AActor::PostActorConstruction ( )

Called after the actor has run its construction. Responsible for finishing the actor spawn process.

bDeferBeginPlayAndUpdateOverlaps &&

◆ PostInitializeComponents()

void Karma::AActor::PostInitializeComponents ( )
virtual

Allow actors to initialize themselves on the C++ side after all of their components have been initialized, only called during gameplay

See also
AActor::PostActorConstruction()

◆ PostSpawnInitialize()

void Karma::AActor::PostSpawnInitialize ( FTransform const & SpawnTransform,
AActor * InOwner,
APawn * InInstigator,
bool bRemoteOwned,
bool bNoFail,
bool bDeferConstruction )

Called after the actor is spawned in the world. Responsible for setting up actor for play.

◆ RemoveOwnedComponent()

void Karma::AActor::RemoveOwnedComponent ( std::shared_ptr< UActorComponent > Component)

Removes a component from the OwnedComponents array of the Actor. In general this should not need to be called directly by anything other than UActorComponent functions

◆ SetInstigator()

void Karma::AActor::SetInstigator ( APawn * InInstigator)

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

◆ SetOwner()

void Karma::AActor::SetOwner ( AActor * NewOwner)
virtual

Set the owner of this Actor, used primarily for network replication.

Parameters
NewOwnerThe Actor who takes over ownership of this Actor

◆ SetRootComponent()

bool Karma::AActor::SetRootComponent ( USceneComponent * NewRootComponent)

Sets root component to be the specified component. NewRootComponent's owner should be this actor.

Returns
true if successful

Only components owned by this actor can be used as a its root component.

◆ Tick()

void Karma::AActor::Tick ( float DeltaSeconds)
virtual

Function called every frame on this Actor. Override this function to implement custom logic to be executed every frame. Note that Tick is enabled by default, and you will need to check m_bCanEverTick is set to false to disable it.

Parameters
DeltaSecondsGame time elapsed during last frame modified by the time dilation

Member Data Documentation

◆ m_Children

KarmaVector<AActor*> Karma::AActor::m_Children

Array of all Actors whose Owner is this actor, these are not necessarily spawned by UChildActorComponent Needs to be raw pointer only.

◆ m_CreationTime

float Karma::AActor::m_CreationTime

The time this actor was created, relative to World->GetTimeSeconds().

See also
UWorld::GetTimeSeconds()

◆ m_Owner

AActor* Karma::AActor::m_Owner

Owner of this Actor, used primarily for replication (bNetUseOwnerRelevancy & bOnlyRelevantToOwner) and visibility (PrimitiveComponent bOwnerNoSee and bOnlyOwnerSee)

See also
SetOwner(), GetOwner()

◆ m_RootComponent

USceneComponent* Karma::AActor::m_RootComponent
protected

Event when play begins for this actor. For blueprint trigger The component that defines the transform (location, rotation, scale) of this Actor in the world, all other components must be attached to this one somehow.

Needs be raw pointer only


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