From 594ef5f1587b3f15ab7b337b5666e720615f1dcf Mon Sep 17 00:00:00 2001 From: baz Date: Fri, 9 Feb 2024 21:16:09 +0000 Subject: [PATCH] Create Has Patrol Route Decorator --- .../Nakatomi/Decorators/BTDHasPatrolRoute.cpp | 14 ++++++++++++++ .../Nakatomi/Decorators/BTDHasPatrolRoute.h | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Source/Nakatomi/Decorators/BTDHasPatrolRoute.cpp create mode 100644 Source/Nakatomi/Decorators/BTDHasPatrolRoute.h 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; +};