diff --git a/Source/Nakatomi/TaskReleaseAttackToken.cpp b/Source/Nakatomi/TaskReleaseAttackToken.cpp new file mode 100644 index 0000000..8301fa9 --- /dev/null +++ b/Source/Nakatomi/TaskReleaseAttackToken.cpp @@ -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(owner.GetAIOwner()); + + if (enemyController) + { + enemyController->TryReleaseAttackToken(); + return EBTNodeResult::Succeeded; + } + + return EBTNodeResult::Failed; +} + +EBTNodeResult::Type UTaskReleaseAttackToken::AbortTask(UBehaviorTreeComponent& owner, uint8* memory) +{ + return EBTNodeResult::Aborted; +} diff --git a/Source/Nakatomi/TaskReleaseAttackToken.h b/Source/Nakatomi/TaskReleaseAttackToken.h new file mode 100644 index 0000000..01a7e9b --- /dev/null +++ b/Source/Nakatomi/TaskReleaseAttackToken.h @@ -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; +};