Merge remote-tracking branch 'origin/AI' into Green-Light/Rafals-Branch

This commit is contained in:
Rafal Swierczek 2024-02-29 10:39:12 +00:00
commit ce7d25f21d
18 changed files with 45 additions and 25 deletions

BIN
Assets/UI/UI_Bar_Fill.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/UI/UI_Bar_Outline.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -154,8 +154,8 @@ ManualIPAddress=
+PropertyRedirects=(OldName="/Script/EndlessVendetta.BaseWeaponClass.player",NewName="/Script/EndlessVendetta.BaseWeaponClass.playerInWorld")
[/Script/NavigationSystem.RecastNavMesh]
AgentMaxStepHeight=73.434059
AgentMaxSlope=64.648003
AgentMaxStepHeight=45.929649
AgentMaxSlope=45.053085
CellSize=10.000000
RuntimeGeneration=Dynamic

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -20,16 +20,21 @@ EBTNodeResult::Type UBTTask_AttackPlayer::ExecuteTask(UBehaviorTreeComponent& Ow
{
if (const UBlackboardComponent* const Blackboard = OwnerComp.GetBlackboardComponent())
{
FVector const Origin = AIController->GetPawn()->GetActorLocation();
FVector const Start = Origin + FVector(0.f, 0.f, 30.f);
FVector const PlayerLocation = Blackboard->GetValueAsVector("TargetLocation");
USkeletalMeshComponent* GunSKMesh = nullptr;
if (AIController->GetPawn()->GetComponentsByTag(USkeletalMeshComponent::StaticClass(), "Gun").Num() > 0)
{
GunSKMesh = Cast<USkeletalMeshComponent>(AIController->GetPawn()->GetComponentsByTag(USkeletalMeshComponent::StaticClass(), "Gun")[0]);
}
FVector const Origin = IsValid(GunSKMesh) ? GunSKMesh->GetComponentLocation() : AIController->GetPawn()->GetActorLocation() + FVector(0.f, 0.f, 30.f);
FVector const Start = Origin;
FVector const End = Origin + AIController->GetPawn()->GetActorForwardVector() * 10000.f;
if (AEnemyCharacter* const EnemyCharacter = Cast<AEnemyCharacter>(AIController->GetPawn()))
{
EnemyCharacter->FireWeapon.Broadcast();
EnemyCharacter->SetFiring(true);
FCollisionQueryParams QueryParams;
QueryParams.AddIgnoredActor(AIController->GetPawn());
if (FHitResult HitResult; GetWorld()->LineTraceSingleByChannel(HitResult, Start, PlayerLocation, ECC_Pawn, QueryParams))
if (FHitResult HitResult; GetWorld()->LineTraceSingleByChannel(HitResult, Start, End, ECC_Pawn, QueryParams))
{
if (IsValid(HitResult.GetActor()))
{