prevent player from damaging team member
This commit is contained in:
BIN
Content/Maps/GameLevel.umap
LFS
BIN
Content/Maps/GameLevel.umap
LFS
Binary file not shown.
@@ -205,6 +205,15 @@ void ACCharacter::ReSpawn()
|
|||||||
GetCharacterMovement()->SetMovementMode(MOVE_Walking);
|
GetCharacterMovement()->SetMovementMode(MOVE_Walking);
|
||||||
GetMesh()->GetAnimInstance()->StopAllMontages(0.f);
|
GetMesh()->GetAnimInstance()->StopAllMontages(0.f);
|
||||||
SetStatusGaugeEnabled(true);
|
SetStatusGaugeEnabled(true);
|
||||||
|
|
||||||
|
if (HasAuthority() && GetController())
|
||||||
|
{
|
||||||
|
if (const auto StartSpot { GetController()->StartSpot }; StartSpot.IsValid())
|
||||||
|
{
|
||||||
|
SetActorTransform(StartSpot->GetActorTransform());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (CAbilitySystemComponent)
|
if (CAbilitySystemComponent)
|
||||||
{
|
{
|
||||||
CAbilitySystemComponent->ApplyFullStatEffect();
|
CAbilitySystemComponent->ApplyFullStatEffect();
|
||||||
|
|||||||
@@ -15,11 +15,14 @@ UAnimInstance* UCGameplayAbility::GetOwnerAnimInstance() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
TArray<FHitResult> UCGameplayAbility::GetHitResultFromSweepLocationTargetData(
|
TArray<FHitResult> UCGameplayAbility::GetHitResultFromSweepLocationTargetData(
|
||||||
const FGameplayAbilityTargetDataHandle& TargetDataHandle, float SphereSweepRadius, bool bDrawDebug,
|
const FGameplayAbilityTargetDataHandle& TargetDataHandle, float SphereSweepRadius, ETeamAttitude::Type TargetTeam,
|
||||||
bool bIgnoreSelf) const
|
bool bDrawDebug, bool bIgnoreSelf) const
|
||||||
{
|
{
|
||||||
TArray<FHitResult> OutResults;
|
TArray<FHitResult> OutResults;
|
||||||
TSet<AActor*> HitActors;
|
TSet<AActor*> HitActors;
|
||||||
|
|
||||||
|
const auto OwnerTeamInterface{Cast<IGenericTeamAgentInterface>(GetAvatarActorFromActorInfo())};
|
||||||
|
|
||||||
for (const auto TargetData : TargetDataHandle.Data)
|
for (const auto TargetData : TargetDataHandle.Data)
|
||||||
{
|
{
|
||||||
const FVector StartLoc{TargetData->GetOrigin().GetTranslation()};
|
const FVector StartLoc{TargetData->GetOrigin().GetTranslation()};
|
||||||
@@ -49,6 +52,12 @@ TArray<FHitResult> UCGameplayAbility::GetHitResultFromSweepLocationTargetData(
|
|||||||
for (const auto Result : Results)
|
for (const auto Result : Results)
|
||||||
{
|
{
|
||||||
if (HitActors.Contains(Result.GetActor())) continue;
|
if (HitActors.Contains(Result.GetActor())) continue;
|
||||||
|
|
||||||
|
if (OwnerTeamInterface)
|
||||||
|
{
|
||||||
|
const auto OtherActorTeamAttitude{OwnerTeamInterface->GetTeamAttitudeTowards(*Result.GetActor())};
|
||||||
|
if (OtherActorTeamAttitude != TargetTeam) continue;
|
||||||
|
}
|
||||||
HitActors.Add(Result.GetActor());
|
HitActors.Add(Result.GetActor());
|
||||||
OutResults.Add(Result);
|
OutResults.Add(Result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,9 +152,7 @@ void UGA_Combo::DoDamage(FGameplayEventData Data)
|
|||||||
auto HitResults{
|
auto HitResults{
|
||||||
GetHitResultFromSweepLocationTargetData(
|
GetHitResultFromSweepLocationTargetData(
|
||||||
Data.TargetData,
|
Data.TargetData,
|
||||||
TargetSweepSphereRadius,
|
TargetSweepSphereRadius
|
||||||
false,
|
|
||||||
true
|
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ AActor* ACGameMode::FindNextStartSpotForTeam(const FGenericTeamId& TeamId) const
|
|||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto World{GetWorld()};
|
for (TActorIterator<APlayerStart> It{GetWorld()}; It; ++It)
|
||||||
for (TActorIterator<APlayerStart> It(World); It; ++It)
|
|
||||||
{
|
{
|
||||||
if (It->PlayerStartTag == *StartSpotTag)
|
if (It->PlayerStartTag == *StartSpotTag)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,12 +3,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "GenericTeamAgentInterface.h"
|
||||||
#include "Abilities/GameplayAbility.h"
|
#include "Abilities/GameplayAbility.h"
|
||||||
#include "CGameplayAbility.generated.h"
|
#include "CGameplayAbility.generated.h"
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class CRUNCH_API UCGameplayAbility : public UGameplayAbility
|
class CRUNCH_API UCGameplayAbility : public UGameplayAbility
|
||||||
{
|
{
|
||||||
@@ -17,6 +15,8 @@ class CRUNCH_API UCGameplayAbility : public UGameplayAbility
|
|||||||
protected:
|
protected:
|
||||||
UAnimInstance* GetOwnerAnimInstance() const;
|
UAnimInstance* GetOwnerAnimInstance() const;
|
||||||
TArray<FHitResult> GetHitResultFromSweepLocationTargetData(const FGameplayAbilityTargetDataHandle& TargetDataHandle,
|
TArray<FHitResult> GetHitResultFromSweepLocationTargetData(const FGameplayAbilityTargetDataHandle& TargetDataHandle,
|
||||||
float SphereSweepRadius = 30.f, bool bDrawDebug = false,
|
float SphereSweepRadius = 30.f,
|
||||||
|
ETeamAttitude::Type TargetTeam = ETeamAttitude::Hostile,
|
||||||
|
bool bDrawDebug = false,
|
||||||
bool bIgnoreSelf = true) const;
|
bool bIgnoreSelf = true) const;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user