Compare commits
No commits in common. "6a30ddae07ce781320ba0195a6bc82948d3b2b07" and "8603f2421bfbba182dc6d48c5b974f60627251c6" have entirely different histories.
6a30ddae07
...
8603f2421b
BIN
Content/Enemy/BT_Attacking_State.uasset (Stored with Git LFS)
BIN
Content/Enemy/BT_Attacking_State.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Enemy/BT_Find_Cover.uasset (Stored with Git LFS)
BIN
Content/Enemy/BT_Find_Cover.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Enemy/EQS/AttackTarget.uasset (Stored with Git LFS)
BIN
Content/Enemy/EQS/AttackTarget.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Enemy/EQS/EQS_FindIdealRange.uasset (Stored with Git LFS)
BIN
Content/Enemy/EQS/EQS_FindIdealRange.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Enemy/Worker/AIC_Worker.uasset (Stored with Git LFS)
BIN
Content/Enemy/Worker/AIC_Worker.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Enemy/Worker/BB_Worker.uasset (Stored with Git LFS)
BIN
Content/Enemy/Worker/BB_Worker.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Enemy/Worker/BT_Worker.uasset (Stored with Git LFS)
BIN
Content/Enemy/Worker/BT_Worker.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Enemy/Worker/C_Worker.uasset (Stored with Git LFS)
BIN
Content/Enemy/Worker/C_Worker.uasset (Stored with Git LFS)
Binary file not shown.
Binary file not shown.
|
@ -1,27 +0,0 @@
|
||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
|
|
||||||
#include "../Decorators/BTDCanSeeTarget.h"
|
|
||||||
|
|
||||||
#include "AIController.h"
|
|
||||||
#include "BehaviorTree/BlackboardComponent.h"
|
|
||||||
|
|
||||||
bool UBTDCanSeeTarget::CalculateRawConditionValue(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const
|
|
||||||
{
|
|
||||||
FHitResult HitResult;
|
|
||||||
|
|
||||||
FVector Start = OwnerComp.GetAIOwner()->GetPawn()->GetActorLocation();
|
|
||||||
|
|
||||||
UBlackboardComponent* BlackboardComponent = OwnerComp.GetBlackboardComponent();
|
|
||||||
AActor* TargetActor = Cast<AActor>(BlackboardComponent->GetValueAsObject(TargetActorKey.SelectedKeyName));
|
|
||||||
FVector End = TargetActor->GetActorLocation();
|
|
||||||
|
|
||||||
GetWorld()->LineTraceSingleByChannel(HitResult, Start, End, ECC_Pawn);
|
|
||||||
|
|
||||||
if (HitResult.GetActor())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "BehaviorTree/BTDecorator.h"
|
|
||||||
#include "BTDCanSeeTarget.generated.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
UCLASS()
|
|
||||||
class NAKATOMI_API UBTDCanSeeTarget : public UBTDecorator
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
public:
|
|
||||||
UPROPERTY(EditAnywhere, Category = "Options",
|
|
||||||
Meta = (AllowPrivateAccess = "true", DisplayName = "Target Actor Key"))
|
|
||||||
FBlackboardKeySelector TargetActorKey;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual bool CalculateRawConditionValue(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const override;
|
|
||||||
};
|
|
|
@ -1,14 +0,0 @@
|
||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
|
|
||||||
#include "../Decorators/BTDIsHealthBelowThreshold.h"
|
|
||||||
|
|
||||||
#include "BehaviorTree/BlackboardComponent.h"
|
|
||||||
|
|
||||||
bool UBTDIsHealthBelowThreshold::CalculateRawConditionValue(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const
|
|
||||||
{
|
|
||||||
UBlackboardComponent* BlackboardComponent = OwnerComp.GetBlackboardComponent();
|
|
||||||
float currentHealth = BlackboardComponent->GetValueAsFloat(CurrentHealthKey.SelectedKeyName);
|
|
||||||
|
|
||||||
return currentHealth <= HealthThreshold ? true : false;
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "BehaviorTree/BTDecorator.h"
|
|
||||||
#include "BTDIsHealthBelowThreshold.generated.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
UCLASS()
|
|
||||||
class NAKATOMI_API UBTDIsHealthBelowThreshold : public UBTDecorator
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, Category = "Options",
|
|
||||||
Meta = (AllowPrivateAccess = "true", DisplayName = "Current Health Key"))
|
|
||||||
FBlackboardKeySelector CurrentHealthKey;
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, Category = "Options",
|
|
||||||
Meta = (AllowPrivateAccess = "true", DisplayName = "Health Threshold"))
|
|
||||||
float HealthThreshold = 25.0f;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual bool CalculateRawConditionValue(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const override;
|
|
||||||
};
|
|
|
@ -1,23 +0,0 @@
|
||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
|
|
||||||
#include "../Decorators/BTDWeaponCooldown.h"
|
|
||||||
|
|
||||||
#include "AIController.h"
|
|
||||||
#include "Nakatomi/EnemyCharacter.h"
|
|
||||||
|
|
||||||
void UBTDWeaponCooldown::TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds)
|
|
||||||
{
|
|
||||||
AEnemyCharacter* EnemyCharacter = Cast<AEnemyCharacter>(OwnerComp.GetAIOwner()->GetPawn());
|
|
||||||
|
|
||||||
if (EnemyCharacter && EnemyCharacter->GetCurrentWeapon())
|
|
||||||
{
|
|
||||||
const float Cooldown = EnemyCharacter->GetCurrentWeapon()->GetWeaponProperties()->WeaponCooldown;
|
|
||||||
if (CoolDownTime != Cooldown)
|
|
||||||
{
|
|
||||||
CoolDownTime = Cooldown;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Super::TickNode(OwnerComp, NodeMemory, DeltaSeconds);
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "BehaviorTree/Decorators/BTDecorator_Cooldown.h"
|
|
||||||
#include "BTDWeaponCooldown.generated.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
UCLASS()
|
|
||||||
class NAKATOMI_API UBTDWeaponCooldown : public UBTDecorator_Cooldown
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds) override;
|
|
||||||
};
|
|
|
@ -4,9 +4,6 @@
|
||||||
#include "EnemyAIController.h"
|
#include "EnemyAIController.h"
|
||||||
#include "EnemyHealthComponent.h"
|
#include "EnemyHealthComponent.h"
|
||||||
#include "InteractableComponent.h"
|
#include "InteractableComponent.h"
|
||||||
#include "BehaviorTree/BehaviorTree.h"
|
|
||||||
#include "BehaviorTree/BlackboardComponent.h"
|
|
||||||
#include "BehaviorTree/BlackboardData.h"
|
|
||||||
|
|
||||||
#define COLLISION_WEAPON ECC_GameTraceChannel1
|
#define COLLISION_WEAPON ECC_GameTraceChannel1
|
||||||
|
|
||||||
|
@ -19,7 +16,7 @@ AEnemyCharacter::AEnemyCharacter(const FObjectInitializer& ObjectInitializer) :
|
||||||
GetHealthComponent()->OnDamaged.BindUFunction(this, "OnDamaged");
|
GetHealthComponent()->OnDamaged.BindUFunction(this, "OnDamaged");
|
||||||
GetHealthComponent()->OnDeath.BindUFunction(this, "OnDeath");
|
GetHealthComponent()->OnDeath.BindUFunction(this, "OnDeath");
|
||||||
GetHealthComponent()->SetMaxHealth(100.0f);
|
GetHealthComponent()->SetMaxHealth(100.0f);
|
||||||
|
|
||||||
this->Tags.Add(FName("Enemy"));
|
this->Tags.Add(FName("Enemy"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,10 +54,6 @@ void AEnemyCharacter::WeaponCooldownHandler()
|
||||||
void AEnemyCharacter::BeginPlay()
|
void AEnemyCharacter::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
|
||||||
AEnemyAIController* controller = Cast<AEnemyAIController>(GetController());
|
|
||||||
controller->GetBlackboardComponent()->SetValueAsFloat("CurrentHealth", GetHealthComponent()->GetCurrentHealth());
|
|
||||||
GetHealthComponent()->OnDamaged.BindUFunction(this, "OnDamaged");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AEnemyCharacter::PlayOnFireAnimations()
|
void AEnemyCharacter::PlayOnFireAnimations()
|
||||||
|
@ -137,12 +130,3 @@ void AEnemyCharacter::ProcessHits(TArray<FHitResult> hits)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AEnemyCharacter::OnDamaged()
|
|
||||||
{
|
|
||||||
Super::OnDamaged();
|
|
||||||
|
|
||||||
AEnemyAIController* controller = Cast<AEnemyAIController>(GetController());
|
|
||||||
controller->GetBlackboardComponent()->SetValueAsFloat("CurrentHealth", GetHealthComponent()->GetCurrentHealth());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,4 @@ private:
|
||||||
virtual void CalculateHits(TArray<FHitResult>* hits) override;
|
virtual void CalculateHits(TArray<FHitResult>* hits) override;
|
||||||
|
|
||||||
virtual void ProcessHits(TArray<FHitResult> hits) override;
|
virtual void ProcessHits(TArray<FHitResult> hits) override;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void OnDamaged() override;
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue