Bugfix Enemy Runs Away when User Init Combat
This commit is contained in:
parent
6092c22a2b
commit
e91d059c56
@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
#include "TurnBaseCombatV2.h"
|
#include "TurnBaseCombatV2.h"
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "BehaviorTree/BlackboardComponent.h"
|
#include "AIController.h"
|
||||||
#include "Blueprint/UserWidget.h"
|
#include "Blueprint/UserWidget.h"
|
||||||
|
#include "BehaviorTree/BlackboardComponent.h"
|
||||||
#include "Components/TextBlock.h"
|
#include "Components/TextBlock.h"
|
||||||
#include "Components/ProgressBar.h"
|
#include "Components/ProgressBar.h"
|
||||||
#include "GameFramework/Character.h"
|
#include "GameFramework/Character.h"
|
||||||
@ -24,8 +25,10 @@ ATurnBaseCombatV2::ATurnBaseCombatV2()
|
|||||||
void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
|
void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
|
||||||
{
|
{
|
||||||
if (Enemy == nullptr) return;
|
if (Enemy == nullptr) return;
|
||||||
UBlackboardComponent* EnemyBlackboard = Cast<UBlackboardComponent>(Enemy->GetComponentByClass(UBlackboardComponent::StaticClass()));
|
UBlackboardComponent* EnemyBlackboard = Cast<AAIController>(Enemy->GetInstigatorController())->GetBlackboardComponent();
|
||||||
|
|
||||||
if (EnemyBlackboard->GetValueAsBool("IsInCombat")) return;
|
if (EnemyBlackboard->GetValueAsBool("IsInCombat")) return;
|
||||||
|
EnemyBlackboard->SetValueAsBool("IsInCombat", true);
|
||||||
FProperty* HealthProperty = Enemy->GetClass()->FindPropertyByName(FName("Health"));
|
FProperty* HealthProperty = Enemy->GetClass()->FindPropertyByName(FName("Health"));
|
||||||
int32* EnemyHealthPtr = HealthProperty->ContainerPtrToValuePtr<int32>(Enemy);
|
int32* EnemyHealthPtr = HealthProperty->ContainerPtrToValuePtr<int32>(Enemy);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ public class the_twilight_abyss : ModuleRules
|
|||||||
{
|
{
|
||||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Niagara" });
|
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Niagara", "AIModule" });
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ public class the_twilight_abyssEditorTarget : TargetRules
|
|||||||
{
|
{
|
||||||
Type = TargetType.Editor;
|
Type = TargetType.Editor;
|
||||||
DefaultBuildSettings = BuildSettingsVersion.V2;
|
DefaultBuildSettings = BuildSettingsVersion.V2;
|
||||||
|
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;
|
||||||
ExtraModuleNames.AddRange( new string[] { "the_twilight_abyss" } );
|
ExtraModuleNames.AddRange( new string[] { "the_twilight_abyss" } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user