KarmaEngine
Game Engine for practical learning and research purposes
|
Actor is the base class for an object that can be placed or spawned in a level. More...
#include <Actor.h>
Public Member Functions | |
AActor () | |
ULevel * | GetLevel () const |
void | PostSpawnInitialize (FTransform const &SpawnTransform, AActor *InOwner, APawn *InInstigator, bool bRemoteOwned, bool bNoFail, bool bDeferConstruction) |
virtual UWorld * | GetWorld () 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 USceneComponent * | GetRootComponent () const |
bool | SetRootComponent (USceneComponent *NewRootComponent) |
const FTransform & | GetTransform () const |
const FTransform & | ActorToWorld () const |
void | InitializeComponents () |
virtual void | PostInitializeComponents () |
AActor * | GetParentActor () const |
UChildActorComponent * | GetParentComponent () const |
void | RemoveOwnedComponent (std::shared_ptr< UActorComponent > Component) |
bool | GetAutoDestroyWhenFinished () const |
bool | CanTick () const |
void | DisableTick (bool bDisable) |
virtual void | Tick (float DeltaSeconds) |
![]() | |
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. | |
![]() | |
UObjectBase (UClass *inClass, EObjectFlags inFlags, EInternalObjectFlags inInternalFlags, UObject *inOuter, const std::string &inName) | |
UPackage * | GetPackage () const |
UPackage * | GetExternalPackage () const |
bool | IsUnreachable () const |
FORCEINLINE void | SetInternalIndex (uint32_t StoreIndex) |
FORCEINLINE uint32_t | GetInternalIndex () const |
void | MarkAsGarbage () |
void | ClearGarbage () |
FORCEINLINE const std::string & | GetName () const |
FORCEINLINE void | SetObjectName (const std::string &aName) |
FORCEINLINE UObject * | GetOuter () const |
UObject * | GetTypedOuter (UClass *Target) const |
template<typename T> | |
T * | GetTypedOuter () const |
bool | IsValidLowLevel () const |
template<typename OtherClassType> | |
FORCEINLINE bool | IsA (OtherClassType SomeBase) const |
FORCEINLINE UClass * | GetClass () const |
FORCEINLINE EObjectFlags | GetFlags () const |
FORCEINLINE void | SetFlags (EObjectFlags NewFlags) |
FORCEINLINE void | ClearFlags (EObjectFlags FlagsToClear) |
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 USceneComponent * | FixupNativeActorComponents (AActor *Actor) |
![]() | |
static const char * | StaticConfigName () |
![]() | |
static FORCEINLINE EInternalObjectFlags | FixGarbageOrPendingKillInternalObjectFlags (const EInternalObjectFlags InFlags) |
Public Attributes | |
float | m_CreationTime |
AActor * | m_Owner |
KarmaVector< AActor * > | m_Children |
Protected Member Functions | |
virtual void | BeginPlay () |
![]() | |
UObjectBase () | |
Providing a default constructor. | |
FORCEINLINE void | SetFlagsTo (EObjectFlags NewFlags) |
Protected Attributes | |
USceneComponent * | m_RootComponent |
bool | m_bCanEverTick |
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.
Karma::AActor::AActor | ( | ) |
Default constructor for AActor
|
inline |
Get the local-to-world transform of the RootComponent. Identical to GetTransform().
|
protectedvirtual |
Overridable native event for when play begins for this actor.
|
inline |
Fory querying if the actor can tick.
|
inline |
Routine to enable or disable actor ticking
bDisable | Parameter to set actor ticking |
void Karma::AActor::DispatchBeginPlay | ( | bool | bFromLevelStreaming = false | ) |
Initiate a begin play call on this Actor, will handle calling in the correct order.
bFromLevelStreaming | - Not functinal - |
GetPathName()
|
static |
Utility to call OnComponentCreated on components
NewActor | The newly created actor |
void Karma::AActor::FinishSpawning | ( | const FTransform & | Transform, |
bool | bIsDefaultTransform = false ) |
Called to finish the spawning process, generally in the case of deferred spawning
Transform | The FTransform of the spawned actor |
bIsDefaultTransform | - Not functional - |
|
static |
Utility that sets up the actor's component hierarchy (when users forget to do so, in their native ctor)
Actor | The actor whose components hierarchy needs to be fixed |
|
inline |
Returns the m_bAutoDestoryWhenFinished
|
inline |
Gathers the actor owned componets and appends the OutComponents likewise
OutComponents | The vector of components which is filled with elements of m_OwnedComponents |
|
inline |
Get all components derived from class 'ComponentType' and fill in the OutComponents array with the result.
bIncludeFromChildActors | If true then recurse in to ChildActor components and find components of the appropriate type in those Actors as well |
ULevel * Karma::AActor::GetLevel | ( | ) | const |
Return the ULevel that this Actor is part of.
AActor * Karma::AActor::GetParentActor | ( | ) | const |
If this Actor was created by a Child Actor Component returns the Actor that owns that Child Actor Component
UChildActorComponent * Karma::AActor::GetParentComponent | ( | ) | const |
If this Actor was created by a Child Actor Component returns that Child Actor Component
|
inline |
Returns this actor's root component.
|
inline |
Get the actor-to-world transform.
|
finaloverridevirtual |
Getter for the cached world pointer, will return null if the actor is not actually spawned in a level
Reimplemented from Karma::UObject.
|
inline |
Returns whether an actor has had BeginPlay called on it (and not subsequently had EndPlay called)
void Karma::AActor::InitializeComponents | ( | ) |
Iterate over components array and call InitializeComponent, which happens once per actor
|
inline |
Returns whether an actor is in the process of beginning play
|
inline |
See if this actor is owned by TestOwner.
TestOwner | The actor to be testified with |
void Karma::AActor::PostActorConstruction | ( | ) |
Called after the actor has run its construction. Responsible for finishing the actor spawn process.
bDeferBeginPlayAndUpdateOverlaps &&
|
virtual |
Allow actors to initialize themselves on the C++ side after all of their components have been initialized, only called during gameplay
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.
For instance the time of spawning is recorded, owner is set, instigator is set, and all that.
SpawnTransform | The FTransform of the actor with which the spawning happens |
InOwner | The actor that owns this actor |
InInstigator | The pawn that is the cause for instigated relevant part of actor |
bRemoteOwned | - Not functional - |
bNoFail | Force continue spawning even if not valid |
bDeferConstruction | - Not functional - (for waiting for BP construction script) |
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
void Karma::AActor::SetInstigator | ( | APawn * | InInstigator | ) |
Sets the value of Instigator without causing other side effects to this instance.
InInstigator | The pawn who is the cause of instigation by this actor |
|
virtual |
Set the owner of this Actor, used primarily for network replication.
NewOwner | The Actor who takes over ownership of this Actor |
bool Karma::AActor::SetRootComponent | ( | USceneComponent * | NewRootComponent | ) |
Sets root component to be the specified component. NewRootComponent's owner should be this actor.
Only components owned by this actor can be used as a its root component.
|
virtual |
Function called every frame on this Actor. Override this function to implement custom logic to be executed every frame.
DeltaSeconds | Game time elapsed during last frame modified by the time dilation |
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.
float Karma::AActor::m_CreationTime |
The time this actor was created, relative to World->GetTimeSeconds().
AActor* Karma::AActor::m_Owner |
Owner of this Actor, used primarily for replication (bNetUseOwnerRelevancy & bOnlyRelevantToOwner) and visibility (PrimitiveComponent bOwnerNoSee and bOnlyOwnerSee)
|
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