From 6e1260a0dd5e0cd8431778b79ce60de950495640 Mon Sep 17 00:00:00 2001 From: Louis Hobbs Date: Mon, 28 Aug 2023 23:45:15 +0100 Subject: [PATCH] Bind UFUNCTION to OnTargetPerceptionUpdated --- Source/Nakatomi/EnemyCharacter.cpp | 8 ++++++++ Source/Nakatomi/EnemyCharacter.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/Source/Nakatomi/EnemyCharacter.cpp b/Source/Nakatomi/EnemyCharacter.cpp index e849be4..e0343fe 100644 --- a/Source/Nakatomi/EnemyCharacter.cpp +++ b/Source/Nakatomi/EnemyCharacter.cpp @@ -26,6 +26,10 @@ AEnemyCharacter::AEnemyCharacter() GetHealthComponent()->SetMaxHealth(100.0f); this->Tags.Add(FName("Enemy")); + + FScriptDelegate Delegate; + Delegate.BindUFunction(this, "OnPerceptionComponentUpdated"); + PerceptionComponent->OnTargetPerceptionUpdated.Add(Delegate); } UBehaviorTree* AEnemyCharacter::GetBehaviourTree() @@ -64,6 +68,10 @@ void AEnemyCharacter::WeaponCooldownHandler() } } +void AEnemyCharacter::OnPerceptionComponentUpdated() +{ +} + void AEnemyCharacter::BeginPlay() { Super::BeginPlay(); diff --git a/Source/Nakatomi/EnemyCharacter.h b/Source/Nakatomi/EnemyCharacter.h index 3f50307..42ea36a 100644 --- a/Source/Nakatomi/EnemyCharacter.h +++ b/Source/Nakatomi/EnemyCharacter.h @@ -44,6 +44,9 @@ public: void WeaponCooldownHandler(); + UFUNCTION() + virtual void OnPerceptionComponentUpdated(); + protected: virtual void BeginPlay() override;