Merge remote-tracking branch 'origin/dev' into WeaponSystem

# Conflicts:
#	EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
This commit is contained in:
MH261677 2023-10-09 14:01:14 +01:00
commit 29b436434b
9 changed files with 32 additions and 23 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:69dcd1314353f09d4f12cc1a2a2ced8540f035585740d097a179bb332d850779
size 4545

View File

@ -3,12 +3,14 @@
#include "AICharacter.h"
#include "AI_CompanionController.h"
#include "AI_EnemyController.h"
#include "Components/CapsuleComponent.h"
#include "Engine/DamageEvents.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "Perception/AIPerceptionStimuliSourceComponent.h"
#include "Perception/AISense_Sight.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "Blueprint/AIBlueprintHelperLibrary.h"
// Sets default values
@ -48,12 +50,13 @@ float AAICharacter::TakeDamage(const float DamageAmount, FDamageEvent const& Dam
CurrentHealth -= DamageAmount;
if (CurrentHealth <= 0)
{
if (!IsValid(this)) return 0.0f;
CurrentHealth = 0;
UE_LOG(LogTemp, Display, TEXT("%s is dead"), *CharacterName.ToString());
const AAI_CompanionController* AIController = Cast<AAI_CompanionController>(GetController());
AIController->GetBrainComponent()->StopLogic(*CharacterName.ToString() + FString(" is dead"));
/*const AAI_EnemyController* AIController = Cast<AAI_EnemyController>(GetController());
AIController->GetBrainComponent()->StopLogic(" is dead");*/
this->Tags.Add(FName("Dead"));
//Ragdoll
DetachFromControllerPendingDestroy();
UCapsuleComponent* CapsuleComp = GetCapsuleComponent();

View File

@ -36,6 +36,14 @@ void AAI_EnemyController::OnPossess(APawn* InPawn)
UBlackboardComponent* TempBlackboardPtr;
UseBlackboard(BehaviorTree->BlackboardAsset, TempBlackboardPtr);
Blackboard = TempBlackboardPtr;
if (IsValid(EnemyCharacter->GetPatrolPath()))
{
Blackboard->SetValueAsBool("IsPatroling", true);
}
else
{
Blackboard->SetValueAsBool("IsPatroling", false);
}
RunBehaviorTree(BehaviorTree);
}
}

View File

@ -5,6 +5,8 @@
#include "CollisionDebugDrawingPublic.h"
#include "Kismet/KismetMathLibrary.h"
#include "Engine/DamageEvents.h"
#include "EndlessVendetta/AI/AICharacter.h"
// Sets default values
AExplosive::AExplosive()
@ -69,6 +71,7 @@ void AExplosive::Explosion()
}
// 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);
Cast<AAICharacter>(OutHit.GetActor())->TakeDamage(DamageToApply, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this);
}
}
PlayExplosionEffects();

View File

@ -8,6 +8,8 @@
#include "Kismet/KismetMathLibrary.h"
#include "Components/CapsuleComponent.h"
#include "Kismet/GameplayStatics.h"
#include "Engine/DamageEvents.h"
#include "EndlessVendetta/AI/EnemyCharacter.h"
// Sets default values
@ -95,16 +97,6 @@ void ABaseWeaponClass::ApplyRecoil(float DeltaTime)
}
//void ABaseWeaponClass::RecoilVerticalLimit(FHitResult Outhit)
//{
// double currentCameraRot = playerInWorld->GetControlRotation().Pitch;
// if (bulletCountShoot >= 3)
// {
//
// }
//}
void ABaseWeaponClass::nullSamples()
{
recoilCurvet = 0;
@ -177,7 +169,7 @@ void ABaseWeaponClass::Fire()
bulletCountShoot += 1;
if (outHit.bBlockingHit)
{
//UE_LOG(LogTemp, Display, TEXT("hit item: %s"), *outHit.GetActor()->GetName());
Cast<AAICharacter>(outHit.GetActor())->TakeDamage(WeaponDamage, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this);
}
}
else if(currentAmmoCount <= 0)