Update Enemy AI to Shoot w/ VFX, SFX & Animation
This commit is contained in:
parent
e4ff17cf4a
commit
0e6c2d5d05
BIN
EndlessVendetta/Content/AI/Enemy/Basic/AfterShot.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/AI/Enemy/Basic/AfterShot.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/AI/Enemy/Basic/BP_BasicEnemyCharacterSwat.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/AI/Enemy/Basic/BP_BasicEnemyCharacterSwat.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/AI/Enemy/Basic/BT_BasicEnemy.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/AI/Enemy/Basic/BT_BasicEnemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Characters/Swat/ABP_Swat.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Characters/Swat/ABP_Swat.uasset
(Stored with Git LFS)
Binary file not shown.
@ -43,6 +43,11 @@ public:
|
|||||||
void SetFiring(bool IsFiring);
|
void SetFiring(bool IsFiring);
|
||||||
virtual void SetFiring_Implementation(bool IsFiring);
|
virtual void SetFiring_Implementation(bool IsFiring);
|
||||||
|
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FFireWeapon);
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintAssignable, Category = "AI")
|
||||||
|
FFireWeapon FireWeapon;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FDelegateHandle AlertLevelDelegateHandle;
|
FDelegateHandle AlertLevelDelegateHandle;
|
||||||
FDelegateHandle HuntPlayerDelegateHandle;
|
FDelegateHandle HuntPlayerDelegateHandle;
|
||||||
|
@ -23,23 +23,22 @@ EBTNodeResult::Type UBTTask_AttackPlayer::ExecuteTask(UBehaviorTreeComponent& Ow
|
|||||||
FVector const Origin = AIController->GetPawn()->GetActorLocation();
|
FVector const Origin = AIController->GetPawn()->GetActorLocation();
|
||||||
FVector const Start = Origin + FVector(0.f, 0.f, 30.f);
|
FVector const Start = Origin + FVector(0.f, 0.f, 30.f);
|
||||||
FVector const PlayerLocation = Blackboard->GetValueAsVector("TargetLocation");
|
FVector const PlayerLocation = Blackboard->GetValueAsVector("TargetLocation");
|
||||||
DrawDebugLine(GetWorld(), Start, PlayerLocation, FColor::Black, false, 1.f, 0, 1.f);
|
|
||||||
|
|
||||||
FCollisionQueryParams QueryParams;
|
|
||||||
QueryParams.AddIgnoredActor(AIController->GetPawn());
|
|
||||||
if (FHitResult HitResult; GetWorld()->LineTraceSingleByChannel(HitResult, Start, PlayerLocation, ECC_Pawn, QueryParams))
|
|
||||||
{
|
|
||||||
if (IsValid(HitResult.GetActor()))
|
|
||||||
{
|
|
||||||
if (HitResult.GetActor()->ActorHasTag("Player"))
|
|
||||||
{
|
|
||||||
Cast<AEndlessVendettaCharacter>(HitResult.GetActor())->TakeDamage(5.0f, FPointDamageEvent(), AIController->GetInstigatorController(), AIController->GetPawn());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (AEnemyCharacter* const EnemyCharacter = Cast<AEnemyCharacter>(AIController->GetPawn()))
|
if (AEnemyCharacter* const EnemyCharacter = Cast<AEnemyCharacter>(AIController->GetPawn()))
|
||||||
{
|
{
|
||||||
|
EnemyCharacter->FireWeapon.Broadcast();
|
||||||
EnemyCharacter->SetFiring(true);
|
EnemyCharacter->SetFiring(true);
|
||||||
|
FCollisionQueryParams QueryParams;
|
||||||
|
QueryParams.AddIgnoredActor(AIController->GetPawn());
|
||||||
|
if (FHitResult HitResult; GetWorld()->LineTraceSingleByChannel(HitResult, Start, PlayerLocation, ECC_Pawn, QueryParams))
|
||||||
|
{
|
||||||
|
if (IsValid(HitResult.GetActor()))
|
||||||
|
{
|
||||||
|
if (HitResult.GetActor()->ActorHasTag("Player"))
|
||||||
|
{
|
||||||
|
Cast<AEndlessVendettaCharacter>(HitResult.GetActor())->TakeDamage(5.0f, FPointDamageEvent(), AIController->GetInstigatorController(), AIController->GetPawn());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FinishLatentTask(OwnerComp, EBTNodeResult::Succeeded);
|
FinishLatentTask(OwnerComp, EBTNodeResult::Succeeded);
|
||||||
return EBTNodeResult::Succeeded;
|
return EBTNodeResult::Succeeded;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user