Update Explosive & AI for Damage Implementation
This commit is contained in:
parent
e3b1d215ef
commit
33b9593f94
BIN
EndlessVendetta/Content/Gadgets/BP_Grenade.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Gadgets/BP_Grenade.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset
(Stored with Git LFS)
Binary file not shown.
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:69dcd1314353f09d4f12cc1a2a2ced8540f035585740d097a179bb332d850779
|
||||||
|
size 4545
|
@ -3,12 +3,14 @@
|
|||||||
|
|
||||||
#include "AICharacter.h"
|
#include "AICharacter.h"
|
||||||
|
|
||||||
#include "AI_CompanionController.h"
|
#include "AI_EnemyController.h"
|
||||||
#include "Components/CapsuleComponent.h"
|
#include "Components/CapsuleComponent.h"
|
||||||
#include "Engine/DamageEvents.h"
|
#include "Engine/DamageEvents.h"
|
||||||
#include "GameFramework/CharacterMovementComponent.h"
|
#include "GameFramework/CharacterMovementComponent.h"
|
||||||
#include "Perception/AIPerceptionStimuliSourceComponent.h"
|
#include "Perception/AIPerceptionStimuliSourceComponent.h"
|
||||||
#include "Perception/AISense_Sight.h"
|
#include "Perception/AISense_Sight.h"
|
||||||
|
#include "BehaviorTree/BlackboardComponent.h"
|
||||||
|
#include "Blueprint/AIBlueprintHelperLibrary.h"
|
||||||
|
|
||||||
|
|
||||||
// Sets default values
|
// Sets default values
|
||||||
@ -48,12 +50,13 @@ float AAICharacter::TakeDamage(const float DamageAmount, FDamageEvent const& Dam
|
|||||||
CurrentHealth -= DamageAmount;
|
CurrentHealth -= DamageAmount;
|
||||||
if (CurrentHealth <= 0)
|
if (CurrentHealth <= 0)
|
||||||
{
|
{
|
||||||
|
if (!IsValid(this)) return 0.0f;
|
||||||
CurrentHealth = 0;
|
CurrentHealth = 0;
|
||||||
UE_LOG(LogTemp, Display, TEXT("%s is dead"), *CharacterName.ToString());
|
UE_LOG(LogTemp, Display, TEXT("%s is dead"), *CharacterName.ToString());
|
||||||
|
|
||||||
const AAI_CompanionController* AIController = Cast<AAI_CompanionController>(GetController());
|
/*const AAI_EnemyController* AIController = Cast<AAI_EnemyController>(GetController());
|
||||||
AIController->GetBrainComponent()->StopLogic(*CharacterName.ToString() + FString(" is dead"));
|
AIController->GetBrainComponent()->StopLogic(" is dead");*/
|
||||||
|
this->Tags.Add(FName("Dead"));
|
||||||
//Ragdoll
|
//Ragdoll
|
||||||
DetachFromControllerPendingDestroy();
|
DetachFromControllerPendingDestroy();
|
||||||
UCapsuleComponent* CapsuleComp = GetCapsuleComponent();
|
UCapsuleComponent* CapsuleComp = GetCapsuleComponent();
|
||||||
|
@ -36,6 +36,14 @@ void AAI_EnemyController::OnPossess(APawn* InPawn)
|
|||||||
UBlackboardComponent* TempBlackboardPtr;
|
UBlackboardComponent* TempBlackboardPtr;
|
||||||
UseBlackboard(BehaviorTree->BlackboardAsset, TempBlackboardPtr);
|
UseBlackboard(BehaviorTree->BlackboardAsset, TempBlackboardPtr);
|
||||||
Blackboard = TempBlackboardPtr;
|
Blackboard = TempBlackboardPtr;
|
||||||
|
if (IsValid(EnemyCharacter->GetPatrolPath()))
|
||||||
|
{
|
||||||
|
Blackboard->SetValueAsBool("IsPatroling", true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Blackboard->SetValueAsBool("IsPatroling", false);
|
||||||
|
}
|
||||||
RunBehaviorTree(BehaviorTree);
|
RunBehaviorTree(BehaviorTree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "CollisionDebugDrawingPublic.h"
|
#include "CollisionDebugDrawingPublic.h"
|
||||||
#include "Kismet/KismetMathLibrary.h"
|
#include "Kismet/KismetMathLibrary.h"
|
||||||
|
#include "Engine/DamageEvents.h"
|
||||||
|
#include "EndlessVendetta/AI/AICharacter.h"
|
||||||
|
|
||||||
// Sets default values
|
// Sets default values
|
||||||
AExplosive::AExplosive()
|
AExplosive::AExplosive()
|
||||||
@ -69,6 +71,7 @@ void AExplosive::Explosion()
|
|||||||
}
|
}
|
||||||
// When merged, call philips take damage function here
|
// When merged, call philips take damage function here
|
||||||
UE_LOG(LogTemp, Warning, TEXT("A shrapnel piece hit %s, dealing %f damage"), *OutHit.GetActor()->GetName(), DamageToApply);
|
UE_LOG(LogTemp, Warning, TEXT("A shrapnel piece hit %s, dealing %f damage"), *OutHit.GetActor()->GetName(), DamageToApply);
|
||||||
|
Cast<AAICharacter>(OutHit.GetActor())->TakeDamage(DamageToApply, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayExplosionEffects();
|
PlayExplosionEffects();
|
||||||
|
Loading…
Reference in New Issue
Block a user