Add TaskReleaseAttackToken AI Task

This commit is contained in:
Louis Hobbs 2023-08-23 00:19:46 +01:00
parent f04bc8378a
commit f0b8c594d4
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,23 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "TaskReleaseAttackToken.h"
#include "EnemyAIController.h"
EBTNodeResult::Type UTaskReleaseAttackToken::ExecuteTask(UBehaviorTreeComponent& owner, uint8* memory)
{
auto enemyController = Cast<AEnemyAIController>(owner.GetAIOwner());
if (enemyController)
{
enemyController->TryReleaseAttackToken();
return EBTNodeResult::Succeeded;
}
return EBTNodeResult::Failed;
}
EBTNodeResult::Type UTaskReleaseAttackToken::AbortTask(UBehaviorTreeComponent& owner, uint8* memory)
{
return EBTNodeResult::Aborted;
}

View File

@ -0,0 +1,22 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "BehaviorTree/BTTaskNode.h"
#include "TaskReleaseAttackToken.generated.h"
/**
*
*/
UCLASS()
class NAKATOMI_API UTaskReleaseAttackToken : public UBTTaskNode
{
GENERATED_BODY()
public:
virtual EBTNodeResult::Type ExecuteTask(UBehaviorTreeComponent& owner, uint8* memory) override;
virtual EBTNodeResult::Type AbortTask(UBehaviorTreeComponent& owner, uint8* memory) override;
};