diff --git a/Source/Nakatomi/Decorators/BTDHasPatrolRoute.cpp b/Source/Nakatomi/Decorators/BTDHasPatrolRoute.cpp new file mode 100644 index 0000000..9345c29 --- /dev/null +++ b/Source/Nakatomi/Decorators/BTDHasPatrolRoute.cpp @@ -0,0 +1,14 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "../Decorators/BTDHasPatrolRoute.h" + +#include "Nakatomi/EnemyAIController.h" + +bool UBTDHasPatrolRoute::CalculateRawConditionValue(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const +{ + AEnemyAIController* enemyController = Cast(OwnerComp.GetAIOwner()); + AEnemyCharacter* enemyPawn = Cast(enemyController->GetPawn()); + + return enemyPawn->CurrentPatrolRoute ? true : false; +} diff --git a/Source/Nakatomi/Decorators/BTDHasPatrolRoute.h b/Source/Nakatomi/Decorators/BTDHasPatrolRoute.h new file mode 100644 index 0000000..c9cc9bd --- /dev/null +++ b/Source/Nakatomi/Decorators/BTDHasPatrolRoute.h @@ -0,0 +1,19 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "BehaviorTree/BTDecorator.h" +#include "BTDHasPatrolRoute.generated.h" + +/** + * + */ +UCLASS(Blueprintable) +class NAKATOMI_API UBTDHasPatrolRoute : public UBTDecorator +{ + GENERATED_BODY() + +public: + virtual bool CalculateRawConditionValue(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const override; +};