Skip to content

Commit

Permalink
fixed the error on SRangedAiChracter.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
MashdorDev committed Feb 19, 2024
1 parent 3906c22 commit 34da0fe
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions Source/unbread/Private/SRangedAICharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ FHitResult ASRangedAICharacter::CapsuleTrace()
{
FHitResult OutHit;
TArray<AActor*> ActorsToIgnore;

TArray<AActor*> IgnoredActors;
ActorsToIgnore.AddUnique(this);

FVector EyesLoc;
FRotator EyesRot;
GetController()->GetPlayerViewPoint(EyesLoc, EyesRot);
Expand All @@ -64,13 +64,13 @@ void ASRangedAICharacter::StartWaponFire()

ToggleADS(true);
AnimValues.bIsShooting = true;

FVector launchLocation = GetActorLocation() + GetActorForwardVector() * 120.0f;

ASProjectile* pr = GetWorld()->SpawnActor<ASProjectile>(Projectile, launchLocation, GetActorRotation());
pr->SetInstigator(this);
pr->SetActorScale3D({0.5f, 0.5f, 0.5f});

if(FireHandle.IsValid())
{
return;
Expand Down Expand Up @@ -98,16 +98,15 @@ void ASRangedAICharacter::BeginPlay()

float ASRangedAICharacter::TakeDamage(float DamageAmount, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser)
{

const float DamageApplied = Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser);

const ASRangedAICharacter* chr = Cast<ASRangedAICharacter>(DamageCauser->GetInstigator());
if(chr && (chr == this || chr->faction == faction))

if(chr && (chr == this || chr->faction == faction))
{
return 0.0f;
}

Health -= DamageApplied;

if(ControllerRef)
Expand Down Expand Up @@ -149,7 +148,7 @@ bool ASRangedAICharacter::CanBeSeenFrom(const FVector& ObserverLocation, FVector
int32* UserData) const
{
static const FName NAME_AILineOfSight = FName(TEXT("TestPawnLineOfSight"));

FHitResult HitResult;
FVector SocketLocaiton = GetMesh()->GetSocketLocation(PerceptionTarget);

Expand All @@ -172,7 +171,7 @@ bool ASRangedAICharacter::CanBeSeenFrom(const FVector& ObserverLocation, FVector
FCollisionQueryParams(NAME_AILineOfSight, true, IgnoreActor));

NumberOfLoSChecksPerformed++;

if(bHitSocket == false || (HitResult.GetActor()->IsOwnedBy(this)))
{
OutSeenLocation = GetActorLocation();
Expand All @@ -181,7 +180,7 @@ bool ASRangedAICharacter::CanBeSeenFrom(const FVector& ObserverLocation, FVector
return true;
}
OutSightStrength = 0;

return false;
}

Expand Down

0 comments on commit 34da0fe

Please sign in to comment.