Add TaskReleaseAttackToken AI Task
This commit is contained in:
parent
f04bc8378a
commit
f0b8c594d4
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
};
|
Loading…
Reference in New Issue