Damage `EnemyCharacter` in `CalculateHits`
This commit is contained in:
parent
e06e724c0c
commit
8a54837ad6
|
@ -9,6 +9,8 @@
|
||||||
#include "GameFramework/CharacterMovementComponent.h"
|
#include "GameFramework/CharacterMovementComponent.h"
|
||||||
#include "InputMappingContext.h"
|
#include "InputMappingContext.h"
|
||||||
#include "Destructable.h"
|
#include "Destructable.h"
|
||||||
|
#include "EnemyCharacter.h"
|
||||||
|
|
||||||
|
|
||||||
#define COLLISION_WEAPON ECC_GameTraceChannel1
|
#define COLLISION_WEAPON ECC_GameTraceChannel1
|
||||||
|
|
||||||
|
@ -245,17 +247,17 @@ void APlayerCharacter::CalculateHits(TArray<FHitResult>* hits)
|
||||||
// Spawn field actor
|
// Spawn field actor
|
||||||
FTransform transform;
|
FTransform transform;
|
||||||
transform.SetLocation(Result.ImpactPoint);
|
transform.SetLocation(Result.ImpactPoint);
|
||||||
GetWorld()->SpawnActor<AFieldSystemActor>(CurrentWeapon->GetFieldSystemActor(), transform, SpawnParameters);
|
auto field = GetWorld()->SpawnActor<AFieldSystemActor>(CurrentWeapon->GetFieldSystemActor(), transform, SpawnParameters);
|
||||||
|
fields.Add(field);
|
||||||
if (Result.GetActor()->ActorHasTag(FName("Destructable")))
|
|
||||||
|
if (Result.GetActor())
|
||||||
{
|
{
|
||||||
// TODO: Do thing
|
if (Result.GetActor()->ActorHasTag("Enemy"))
|
||||||
auto destructable = Cast<ADestructable>(Result.GetActor());
|
{
|
||||||
destructable->Destruct();
|
// TODO: Do thing
|
||||||
}
|
auto enemy = Cast<AEnemyCharacter>(Result.GetActor());
|
||||||
else if (Result.GetActor()->ActorHasTag(FName("Enemy")))
|
enemy->GetHealthComponent()->TakeDamage(Result.GetActor(),CurrentWeapon->GetWeaponProperties()->WeaponDamage, nullptr, GetController(), this);
|
||||||
{
|
}
|
||||||
// TODO: Do thing
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,12 @@
|
||||||
#include "EnhancedInputComponent.h"
|
#include "EnhancedInputComponent.h"
|
||||||
#include "NakatomiCharacter.h"
|
#include "NakatomiCharacter.h"
|
||||||
#include "Weapon.h"
|
#include "Weapon.h"
|
||||||
|
#include "Engine/EngineTypes.h"
|
||||||
|
#include "Engine/DamageEvents.h"
|
||||||
#include "PlayerCharacter.generated.h"
|
#include "PlayerCharacter.generated.h"
|
||||||
|
|
||||||
class UInputAction;
|
class UInputAction;
|
||||||
class UInputMappingContext;
|
class UInputMappingContext;
|
||||||
//class UEnhancedInputComponent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue