Update AI for Hit Location Damage, Dynamic Crosshair & Hit Markers
This commit is contained in:
parent
d7a0ffbbec
commit
7ae5c1f349
@ -40,6 +40,7 @@
|
|||||||
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False,Name="Projectile")
|
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False,Name="Projectile")
|
||||||
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel2,DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False,Name="Waypoint")
|
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel2,DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False,Name="Waypoint")
|
||||||
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel3,DefaultResponse=ECR_Ignore,bTraceType=False,bStaticObject=False,Name="Player")
|
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel3,DefaultResponse=ECR_Ignore,bTraceType=False,bStaticObject=False,Name="Player")
|
||||||
|
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel4,DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False,Name="Enemy")
|
||||||
+EditProfiles=(Name="Trigger",CustomResponses=((Channel="Projectile",Response=ECR_Ignore)))
|
+EditProfiles=(Name="Trigger",CustomResponses=((Channel="Projectile",Response=ECR_Ignore)))
|
||||||
-ProfileRedirects=(OldName="BlockingVolume",NewName="InvisibleWall")
|
-ProfileRedirects=(OldName="BlockingVolume",NewName="InvisibleWall")
|
||||||
-ProfileRedirects=(OldName="InterpActor",NewName="IgnoreOnlyPawn")
|
-ProfileRedirects=(OldName="InterpActor",NewName="IgnoreOnlyPawn")
|
||||||
|
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/Assets/Crosshair/Crosshair.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Assets/Crosshair/Crosshair.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Assets/Crosshair/CrosshairDot.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Assets/Crosshair/CrosshairDot.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Assets/Crosshair/CrosshairHitMarker.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Assets/Crosshair/CrosshairHitMarker.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BP_MainCharacter.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BP_MainCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Crosshair.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Crosshair.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Levels/AITest.umap
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Levels/AITest.umap
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/AITest/4/DF/EI4FFQ2STMC3TRHBQOUNH5.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/AITest/4/DF/EI4FFQ2STMC3TRHBQOUNH5.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/AITest/B/8N/O8PP5KE5USY7FTAE75J65R.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/AITest/B/8N/O8PP5KE5USY7FTAE75J65R.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/AITest/B/O6/IM2ZR0FZ5KH20UIRPAQT2P.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/AITest/B/O6/IM2ZR0FZ5KH20UIRPAQT2P.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/AITest/E/4D/8WWZ3L89CIZXU8SGZKVRZ7.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/AITest/E/4D/8WWZ3L89CIZXU8SGZKVRZ7.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -12,6 +12,7 @@ AAI_RestrictedZone::AAI_RestrictedZone()
|
|||||||
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||||
PrimaryActorTick.bCanEverTick = true;
|
PrimaryActorTick.bCanEverTick = true;
|
||||||
BoxCollision = CreateDefaultSubobject<UBoxComponent>(TEXT("BoxCollision"));
|
BoxCollision = CreateDefaultSubobject<UBoxComponent>(TEXT("BoxCollision"));
|
||||||
|
BoxCollision->SetCollisionResponseToChannel(ECC_EngineTraceChannel4, ECR_Overlap);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the game starts or when spawned
|
// Called when the game starts or when spawned
|
||||||
|
@ -70,6 +70,11 @@ void AEndlessVendettaCharacter::SetOverlayState(const EOverlayState OverlayState
|
|||||||
SetOverlayStateEvent.Broadcast(OverlayState);
|
SetOverlayStateEvent.Broadcast(OverlayState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AEndlessVendettaCharacter::SuccessfulHit(const bool bIsHeadshot) const
|
||||||
|
{
|
||||||
|
SuccessfulHitEvent.Broadcast(bIsHeadshot);
|
||||||
|
}
|
||||||
|
|
||||||
void AEndlessVendettaCharacter::BeginPlay()
|
void AEndlessVendettaCharacter::BeginPlay()
|
||||||
{
|
{
|
||||||
// Call the base class
|
// Call the base class
|
||||||
|
@ -171,6 +171,13 @@ public:
|
|||||||
UPROPERTY(BlueprintAssignable, Category = "Restricted Area")
|
UPROPERTY(BlueprintAssignable, Category = "Restricted Area")
|
||||||
FRestrictedAreaStatusChangedSignature RestrictedAreaStatusChanged;
|
FRestrictedAreaStatusChangedSignature RestrictedAreaStatusChanged;
|
||||||
|
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FSuccessfulHitEvent, bool, bIsHeadshot);
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintAssignable, Category = "Weapons")
|
||||||
|
FSuccessfulHitEvent SuccessfulHitEvent;
|
||||||
|
|
||||||
|
void SuccessfulHit(bool bIsHeadshot) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
virtual void Tick(float DeltaTime) override;
|
virtual void Tick(float DeltaTime) override;
|
||||||
|
@ -179,7 +179,11 @@ void ABaseWeaponClass::Fire()
|
|||||||
traceStart = Cast<USkeletalMeshComponent>(GetComponentByClass(USkeletalMeshComponent::StaticClass()))->GetSocketLocation("Muzzle");
|
traceStart = Cast<USkeletalMeshComponent>(GetComponentByClass(USkeletalMeshComponent::StaticClass()))->GetSocketLocation("Muzzle");
|
||||||
traceEnd = traceStart + Cast<AEndlessVendettaCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->GetFirstPersonCameraComponent()->GetForwardVector() * BulletDistance;
|
traceEnd = traceStart + Cast<AEndlessVendettaCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->GetFirstPersonCameraComponent()->GetForwardVector() * BulletDistance;
|
||||||
if (GetWorldTimerManager().IsTimerActive(timerHandle)) return;
|
if (GetWorldTimerManager().IsTimerActive(timerHandle)) return;
|
||||||
GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams);
|
FCollisionObjectQueryParams ObjectQueryParams;
|
||||||
|
ObjectQueryParams.AddObjectTypesToQuery(ECC_Pawn);
|
||||||
|
ObjectQueryParams.AddObjectTypesToQuery(ECC_WorldStatic);
|
||||||
|
ObjectQueryParams.AddObjectTypesToQuery(ECC_WorldDynamic);
|
||||||
|
GetWorld()->LineTraceSingleByObjectType(outHit, traceStart, traceEnd, ObjectQueryParams, collisionParams);
|
||||||
WeaponFired.Broadcast();
|
WeaponFired.Broadcast();
|
||||||
playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1);
|
playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1);
|
||||||
currentAmmoCount -= 1;
|
currentAmmoCount -= 1;
|
||||||
@ -197,9 +201,24 @@ void ABaseWeaponClass::Fire()
|
|||||||
{
|
{
|
||||||
tempWeaponDamage = WeaponDamage;
|
tempWeaponDamage = WeaponDamage;
|
||||||
}
|
}
|
||||||
if (ATargetDummy* TargetDummy = Cast<ATargetDummy>(outHit.GetActor())) TargetDummy->TargetShot();
|
if (Cast<AAICharacter>(outHit.GetActor()))
|
||||||
if (!Cast<AAICharacter>(outHit.GetActor())) return;
|
{
|
||||||
Cast<AAICharacter>(outHit.GetActor())->TakeDamage(tempWeaponDamage, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this);
|
if (outHit.BoneName.ToString().ToLower() == "head")
|
||||||
|
{
|
||||||
|
tempWeaponDamage *= 2;
|
||||||
|
endlessVendettaChar->SuccessfulHit(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
endlessVendettaChar->SuccessfulHit(false);
|
||||||
|
}
|
||||||
|
Cast<AAICharacter>(outHit.GetActor())->TakeDamage(tempWeaponDamage, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this);
|
||||||
|
}
|
||||||
|
if (ATargetDummy* TargetDummy = Cast<ATargetDummy>(outHit.GetActor()))
|
||||||
|
{
|
||||||
|
TargetDummy->TargetShot();
|
||||||
|
endlessVendettaChar->SuccessfulHit(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
HideNeedReloadUI();
|
HideNeedReloadUI();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user