Compare commits
2 Commits
a13083e1fe
...
03d5b80a0b
Author | SHA1 | Date |
---|---|---|
baz | 03d5b80a0b | |
baz | 408954c96d |
|
@ -0,0 +1,14 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "../Tasks/BTTClearFocus.h"
|
||||||
|
|
||||||
|
#include "Nakatomi/EnemyAIController.h"
|
||||||
|
|
||||||
|
EBTNodeResult::Type UBTTClearFocus::ExecuteTask(UBehaviorTreeComponent& owner, uint8* memory)
|
||||||
|
{
|
||||||
|
auto enemyController = Cast<AEnemyAIController>(owner.GetAIOwner());
|
||||||
|
enemyController->ClearFocus(EAIFocusPriority::Default);
|
||||||
|
enemyController->SetFocus();
|
||||||
|
return EBTNodeResult::Succeeded;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "BehaviorTree/BTTaskNode.h"
|
||||||
|
#include "BTTClearFocus.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class NAKATOMI_API UBTTClearFocus : public UBTTaskNode
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual EBTNodeResult::Type ExecuteTask(UBehaviorTreeComponent& owner, uint8* memory) override;
|
||||||
|
|
||||||
|
};
|
|
@ -0,0 +1,20 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "../Tasks/BTTSetFocus.h"
|
||||||
|
|
||||||
|
#include "BehaviorTree/BlackboardComponent.h"
|
||||||
|
#include "Nakatomi/EnemyAIController.h"
|
||||||
|
#include "Nakatomi/PlayerCharacter.h"
|
||||||
|
|
||||||
|
EBTNodeResult::Type UBTTSetFocus::ExecuteTask(UBehaviorTreeComponent& owner, uint8* memory)
|
||||||
|
{
|
||||||
|
UBlackboardComponent* BlackboardComponent = owner.GetBlackboardComponent();
|
||||||
|
UObject* actor = BlackboardComponent->GetValueAsObject(TargetActorKey.SelectedKeyName);
|
||||||
|
APlayerCharacter* PlayerCharacter = Cast<APlayerCharacter>(actor);
|
||||||
|
|
||||||
|
AEnemyAIController* enemyController = Cast<AEnemyAIController>(owner.GetAIOwner());
|
||||||
|
enemyController->SetFocus(PlayerCharacter, EAIFocusPriority::Gameplay);
|
||||||
|
|
||||||
|
return EBTNodeResult::Succeeded;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "BehaviorTree/BTTaskNode.h"
|
||||||
|
#include "BTTSetFocus.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class NAKATOMI_API UBTTSetFocus : public UBTTaskNode
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UPROPERTY(EditAnywhere, Category = "Options",
|
||||||
|
Meta = (AllowPrivateAccess = "true", DisplayName = "Target Actor Key"))
|
||||||
|
FBlackboardKeySelector TargetActorKey;
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual EBTNodeResult::Type ExecuteTask(UBehaviorTreeComponent& owner, uint8* memory) override;
|
||||||
|
|
||||||
|
};
|
Loading…
Reference in New Issue