Bind UFUNCTION to OnTargetPerceptionUpdated

This commit is contained in:
Louis Hobbs 2023-08-28 23:45:15 +01:00
parent 3621378cb3
commit 6e1260a0dd
2 changed files with 11 additions and 0 deletions

View File

@ -26,6 +26,10 @@ AEnemyCharacter::AEnemyCharacter()
GetHealthComponent()->SetMaxHealth(100.0f); GetHealthComponent()->SetMaxHealth(100.0f);
this->Tags.Add(FName("Enemy")); this->Tags.Add(FName("Enemy"));
FScriptDelegate Delegate;
Delegate.BindUFunction(this, "OnPerceptionComponentUpdated");
PerceptionComponent->OnTargetPerceptionUpdated.Add(Delegate);
} }
UBehaviorTree* AEnemyCharacter::GetBehaviourTree() UBehaviorTree* AEnemyCharacter::GetBehaviourTree()
@ -64,6 +68,10 @@ void AEnemyCharacter::WeaponCooldownHandler()
} }
} }
void AEnemyCharacter::OnPerceptionComponentUpdated()
{
}
void AEnemyCharacter::BeginPlay() void AEnemyCharacter::BeginPlay()
{ {
Super::BeginPlay(); Super::BeginPlay();

View File

@ -44,6 +44,9 @@ public:
void WeaponCooldownHandler(); void WeaponCooldownHandler();
UFUNCTION()
virtual void OnPerceptionComponentUpdated();
protected: protected:
virtual void BeginPlay() override; virtual void BeginPlay() override;