Compare commits
No commits in common. "275f86b03fa2712e758c5580f32f357da37e060d" and "b381da27444148838c0e0469b7be7ee61cad2b08" have entirely different histories.
275f86b03f
...
b381da2744
BIN
Content/TestPatrolRoute.uasset (Stored with Git LFS)
BIN
Content/TestPatrolRoute.uasset (Stored with Git LFS)
Binary file not shown.
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "NakatomiCharacter.h"
|
#include "NakatomiCharacter.h"
|
||||||
#include "PatrolRoute.h"
|
|
||||||
#include "BehaviorTree/BehaviorTreeComponent.h"
|
#include "BehaviorTree/BehaviorTreeComponent.h"
|
||||||
#include "RandomWeaponParameters.h"
|
#include "RandomWeaponParameters.h"
|
||||||
#include "EnemyCharacter.generated.h"
|
#include "EnemyCharacter.generated.h"
|
||||||
|
@ -18,10 +17,6 @@ class NAKATOMI_API AEnemyCharacter : public ANakatomiCharacter
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
|
||||||
UPROPERTY(EditAnywhere, Meta = (AllowPrivateAccess = "true"))
|
|
||||||
APatrolRoute* CurrentPatrolRoute;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UPROPERTY(EditDefaultsOnly, Meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditDefaultsOnly, Meta = (AllowPrivateAccess = "true"))
|
||||||
UBehaviorTree* BehaviourTree;
|
UBehaviorTree* BehaviourTree;
|
||||||
|
|
|
@ -24,11 +24,8 @@ void APatrolRoute::IncrementPatrolRoute()
|
||||||
}
|
}
|
||||||
|
|
||||||
PatrolIndex += Direction;
|
PatrolIndex += Direction;
|
||||||
}
|
|
||||||
|
|
||||||
FVector APatrolRoute::GetSplinePointAtWorld()
|
|
||||||
{
|
|
||||||
return GetSplinePointAtWorld(PatrolIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FVector APatrolRoute::GetSplinePointAtWorld(int pointIndex)
|
FVector APatrolRoute::GetSplinePointAtWorld(int pointIndex)
|
||||||
|
|
|
@ -28,7 +28,5 @@ public:
|
||||||
|
|
||||||
void IncrementPatrolRoute();
|
void IncrementPatrolRoute();
|
||||||
|
|
||||||
FVector GetSplinePointAtWorld();
|
|
||||||
|
|
||||||
FVector GetSplinePointAtWorld(int pointIndex);
|
FVector GetSplinePointAtWorld(int pointIndex);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
|
|
||||||
#include "../Tasks/BTTMoveAlongPatrolRoute.h"
|
|
||||||
|
|
||||||
#include "navigationSystem.h"
|
|
||||||
#include "BehaviorTree/BlackboardComponent.h"
|
|
||||||
#include "Nakatomi/EnemyAIController.h"
|
|
||||||
#include "Nakatomi/NakatomiCMC.h"
|
|
||||||
|
|
||||||
EBTNodeResult::Type UBTTMoveAlongPatrolRoute::ExecuteTask(UBehaviorTreeComponent& owner, uint8* memory)
|
|
||||||
{
|
|
||||||
AEnemyAIController* enemyController = Cast<AEnemyAIController>(owner.GetAIOwner());
|
|
||||||
AEnemyCharacter* enemyPawn = Cast<AEnemyCharacter>(enemyController->GetPawn());
|
|
||||||
|
|
||||||
if (enemyPawn->CurrentPatrolRoute)
|
|
||||||
{
|
|
||||||
FVector location = enemyPawn->CurrentPatrolRoute->GetSplinePointAtWorld();
|
|
||||||
UBlackboardComponent* blackboardComponent = owner.GetBlackboardComponent();
|
|
||||||
blackboardComponent->SetValueAsVector(PatrolLocationKey.SelectedKeyName, location);
|
|
||||||
|
|
||||||
enemyPawn->CurrentPatrolRoute->IncrementPatrolRoute();
|
|
||||||
|
|
||||||
return EBTNodeResult::Succeeded;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EBTNodeResult::Failed;
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "BehaviorTree/BTTaskNode.h"
|
|
||||||
#include "BTTMoveAlongPatrolRoute.generated.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
UCLASS()
|
|
||||||
class NAKATOMI_API UBTTMoveAlongPatrolRoute : public UBTTaskNode
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
public:
|
|
||||||
UPROPERTY(EditAnywhere, Category = "Options",
|
|
||||||
Meta = (AllowPrivateAccess = "true", DisplayName = "Patrol Location Key"))
|
|
||||||
FBlackboardKeySelector PatrolLocationKey;
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual EBTNodeResult::Type ExecuteTask(UBehaviorTreeComponent& owner, uint8* memory) override;
|
|
||||||
};
|
|
Loading…
Reference in New Issue