From 00e7ea92275c76faf4c20060d23805e781bb3a4b Mon Sep 17 00:00:00 2001 From: Dor <56084381+MashdorDev@users.noreply.github.com> Date: Wed, 21 Feb 2024 11:41:03 -0500 Subject: [PATCH] Delete Source/unbread/Private/BTTask_MeleeAttack.cpp --- Source/unbread/Private/BTTask_MeleeAttack.cpp | 41 ------------------- 1 file changed, 41 deletions(-) delete mode 100644 Source/unbread/Private/BTTask_MeleeAttack.cpp diff --git a/Source/unbread/Private/BTTask_MeleeAttack.cpp b/Source/unbread/Private/BTTask_MeleeAttack.cpp deleted file mode 100644 index aaf92ae0..00000000 --- a/Source/unbread/Private/BTTask_MeleeAttack.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - - -#include "BTTask_MeleeAttack.h" - -#include "BTTask_MeleeAttack.h" -#include "AIController.h" -#include "GameFramework/Character.h" -#include "BehaviorTree/BlackboardComponent.h" - - -UBTTask_MeleeAttack::UBTTask_MeleeAttack(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) -{ - NodeName = "Melee Attack"; -} - -EBTNodeResult::Type UBTTask_MeleeAttack::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) -{ - if (AAIController* AIController = OwnerComp.GetAIOwner()) - { - if (APawn* Pawn = AIController->GetPawn()) - { - if (UBlackboardComponent* Blackboard = OwnerComp.GetBlackboardComponent()) - { - if (AActor* TargetActor = Cast(Blackboard->GetValueAsObject("TargetActor"))) - { - const float DistanceToTarget = FVector::Dist(Pawn->GetActorLocation(), TargetActor->GetActorLocation()); - - if (DistanceToTarget <= AttackRange) - { - // Perform attack here (e.g., apply damage to TargetActor, play animation) - - // Set cooldown in Blackboard if needed - return EBTNodeResult::Succeeded; - } - } - } - } - } - return EBTNodeResult::Failed; -}