#include <BehaviorEntity.h>
Public Member Functions | |
AZ_RTTI (BehaviorEntity, "{41CC88A4-FE07-48E6-943D-998DE68AFF5C}") | |
AZ_CLASS_ALLOCATOR (BehaviorEntity, AZ::SystemAllocator) | |
BehaviorEntity ()=default | |
BehaviorEntity (AZ::EntityId entityId) | |
BehaviorEntity (AZ::Entity *entity) | |
AZStd::string | GetName () const |
void | SetName (const char *name) |
AZ::EntityId | GetId () const |
EntityContextId | GetOwningContextId () const |
bool | IsValid () const |
bool | Exists () const |
bool | IsActivated () const |
void | Activate () |
void | Deactivate () |
BehaviorComponentId | CreateComponent (const AZ::TypeId &componentTypeId, const AZ::ComponentConfig *componentConfig=nullptr) |
bool | DestroyComponent (BehaviorComponentId componentId) |
AZStd::vector< BehaviorComponentId > | GetComponents () const |
BehaviorComponentId | FindComponentOfType (const AZ::TypeId &componentTypeId) const |
AZStd::vector< BehaviorComponentId > | FindAllComponentsOfType (const AZ::TypeId &componentTypeId) const |
AZ::TypeId | GetComponentType (BehaviorComponentId componentId) const |
AZStd::string | GetComponentName (BehaviorComponentId componentId) const |
bool | SetComponentConfiguration (BehaviorComponentId componentId, const AZ::ComponentConfig &componentConfig) |
bool | GetComponentConfiguration (BehaviorComponentId componentId, AZ::ComponentConfig &outComponentConfig) const |
Static Public Member Functions | |
static void | Reflect (AZ::ReflectContext *context) |
A wrapper around calls to AZ::Entity, for use within the BehaviorContext. It is always safe to call functions on this class even if the entity it represents has been deleted from memory.
|
default |
Constructs an invalid BehaviorEntity. Any methods called on this instance will have no effect.
|
explicit |
Constructs a BehaviorEntity with the given entity ID.
entityId | The ID of the entity. |
|
explicit |
Constructs a BehaviorEntity with the ID of the provided entity.
entity | Entity that this BehaviorEntity will represent. If nullptr is provided then an invalid BehaviorEntity is constructed. |
void AzFramework::BehaviorEntity::Activate | ( | ) |
BehaviorComponentId AzFramework::BehaviorEntity::CreateComponent | ( | const AZ::TypeId & | componentTypeId, |
const AZ::ComponentConfig * | componentConfig = nullptr |
||
) |
Creates a component and attaches it to the entity. You cannot add a component to an entity when the entity is activated.
componentTypeId | Type ID of component to create. For example, pass TransformComponentTypeId to create a TransformComponent. |
componentConfig | (Optional) A configuration to apply to the new component. The configuration class must be of the appropriate type for this component. For example, use a TransformConfig with a TransformComponent. |
void AzFramework::BehaviorEntity::Deactivate | ( | ) |
bool AzFramework::BehaviorEntity::DestroyComponent | ( | BehaviorComponentId | componentId | ) |
Removes the component from the entity and destroys it. You cannot destroy a component while the entity is activated.
componentId | ID of the component to destroy. |
bool AzFramework::BehaviorEntity::Exists | ( | ) | const |
Check whether the entity exists in memory. Note that an entity which exists may or may not be activated.
AZStd::vector< BehaviorComponentId > AzFramework::BehaviorEntity::FindAllComponentsOfType | ( | const AZ::TypeId & | componentTypeId | ) | const |
Gets all components of a specified type registered with the entity.
componentTypeId | The type of component to find. |
BehaviorComponentId AzFramework::BehaviorEntity::FindComponentOfType | ( | const AZ::TypeId & | componentTypeId | ) | const |
Finds the first component of the requested component type.
componentTypeId | The type of component to find. |
bool AzFramework::BehaviorEntity::GetComponentConfiguration | ( | BehaviorComponentId | componentId, |
AZ::ComponentConfig & | outComponentConfig | ||
) | const |
Get a component's configuration.
componentId | The ID of the component to query. |
outComponentConfig[out] | The component will copy its properties into this configuration class. The configuration class must be of the appropriate type for this component. For example, use a TransformConfig with a TransformComponent. |
AZStd::string AzFramework::BehaviorEntity::GetComponentName | ( | BehaviorComponentId | componentId | ) | const |
Get the name of a specific component on the entity.
componentId | the ID of the component to query. |
AZStd::vector< BehaviorComponentId > AzFramework::BehaviorEntity::GetComponents | ( | ) | const |
Gets all components registered with the entity.
AZ::TypeId AzFramework::BehaviorEntity::GetComponentType | ( | BehaviorComponentId | componentId | ) | const |
Get the type of a specific component on the entity.
componentId | The ID of the component to query. |
|
inline |
AZStd::string AzFramework::BehaviorEntity::GetName | ( | ) | const |
EntityContextId AzFramework::BehaviorEntity::GetOwningContextId | ( | ) | const |
Gets the ID of the entity context that the entity belongs to.
bool AzFramework::BehaviorEntity::IsActivated | ( | ) | const |
Check whether the entity is activated.
|
inline |
Check whether this instance has a valid entity ID. Note that a valid entity ID does not indicate whether the entity it represents currently exists in memory.
bool AzFramework::BehaviorEntity::SetComponentConfiguration | ( | BehaviorComponentId | componentId, |
const AZ::ComponentConfig & | componentConfig | ||
) |
Set the component's configuration. You cannot configure a component while the entity is activated.
componentId | The ID of the component to configure. |
componentConfig | The component will set its properties based on this configuration. The configuration class must be of the appropriate type for this component. For example, use a TransformConfig with a TransformComponent. |
void AzFramework::BehaviorEntity::SetName | ( | const char * | name | ) |