Add functionality to TaskAcquireAttackToken

This commit is contained in:
Louis Hobbs 2023-08-23 00:19:30 +01:00
parent 0afcd945ce
commit f04bc8378a
2 changed files with 15 additions and 1 deletions

View File

@ -2,8 +2,21 @@
#include "TaskAcquireAttackToken.h"
#include "EnemyAIController.h"
EBTNodeResult::Type UTaskAcquireAttackToken::ExecuteTask(UBehaviorTreeComponent& owner, uint8* memory)
{
auto enemyController = Cast<AEnemyAIController>(owner.GetAIOwner());
if (enemyController->TryObtainAttackToken())
{
return EBTNodeResult::Succeeded;
}
return EBTNodeResult::Failed;
}
EBTNodeResult::Type UTaskAcquireAttackToken::AbortTask(UBehaviorTreeComponent& owner, uint8* memory)
{
return EBTNodeResult::Aborted;
}

View File

@ -18,4 +18,5 @@ public:
virtual EBTNodeResult::Type ExecuteTask(UBehaviorTreeComponent& owner, uint8* memory) override;
virtual EBTNodeResult::Type AbortTask(UBehaviorTreeComponent& owner, uint8* memory) override;
};