Add Damaged and Death particle effects to enemies
This commit is contained in:
parent
be420b98cf
commit
0a486535f1
BIN
Content/Enemy/DA_Enemy.uasset
(Stored with Git LFS)
BIN
Content/Enemy/DA_Enemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Enemy/NS_EnemyDamaged.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Enemy/NS_EnemyDamaged.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -6,15 +6,14 @@
|
|||||||
#include "EnemyDataAsset.h"
|
#include "EnemyDataAsset.h"
|
||||||
#include "EXPPickup.h"
|
#include "EXPPickup.h"
|
||||||
#include "HealthComponent.h"
|
#include "HealthComponent.h"
|
||||||
#include "MovieSceneTracksComponentTypes.h"
|
|
||||||
#include "ObjectPoolComponent.h"
|
#include "ObjectPoolComponent.h"
|
||||||
#include "ObjectPoolManager.h"
|
#include "ObjectPoolManager.h"
|
||||||
#include "PaperFlipbookComponent.h"
|
|
||||||
#include "VampireAIController.h"
|
#include "VampireAIController.h"
|
||||||
#include "VampireGameMode.h"
|
#include "VampireGameMode.h"
|
||||||
#include "Components/CapsuleComponent.h"
|
#include "Components/CapsuleComponent.h"
|
||||||
#include "Components/SphereComponent.h"
|
#include "Components/SphereComponent.h"
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
|
#include "NiagaraFunctionLibrary.h"
|
||||||
|
|
||||||
AEnemyCharacter::AEnemyCharacter(const FObjectInitializer& ObjectInitializer)
|
AEnemyCharacter::AEnemyCharacter(const FObjectInitializer& ObjectInitializer)
|
||||||
{
|
{
|
||||||
@ -54,6 +53,11 @@ void AEnemyCharacter::OnDamaged(FDamageInfo damageInfo)
|
|||||||
{
|
{
|
||||||
UGameplayStatics::PlaySoundAtLocation(GetWorld(), OnDamagedSound, GetActorLocation());
|
UGameplayStatics::PlaySoundAtLocation(GetWorld(), OnDamagedSound, GetActorLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (OnDamagedNiagaraSystem)
|
||||||
|
{
|
||||||
|
UNiagaraFunctionLibrary::SpawnSystemAtLocation(this, OnDamagedNiagaraSystem, GetActorLocation());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AEnemyCharacter::OnDeath(FDamageInfo damageInfo)
|
void AEnemyCharacter::OnDeath(FDamageInfo damageInfo)
|
||||||
@ -80,6 +84,11 @@ void AEnemyCharacter::OnDeath(FDamageInfo damageInfo)
|
|||||||
{
|
{
|
||||||
UGameplayStatics::PlaySoundAtLocation(GetWorld(), OnDeathSound, GetActorLocation());
|
UGameplayStatics::PlaySoundAtLocation(GetWorld(), OnDeathSound, GetActorLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (OnDeathNiagaraSystem)
|
||||||
|
{
|
||||||
|
UNiagaraFunctionLibrary::SpawnSystemAtLocation(this, OnDeathNiagaraSystem, GetActorLocation());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AEnemyCharacter::LoadDataFromDataAsset_Implementation(UEnemyDataAsset* enemyDataAsset)
|
void AEnemyCharacter::LoadDataFromDataAsset_Implementation(UEnemyDataAsset* enemyDataAsset)
|
||||||
@ -91,6 +100,8 @@ void AEnemyCharacter::LoadDataFromDataAsset_Implementation(UEnemyDataAsset* enem
|
|||||||
PickupTemplate = enemyDataAsset->PickupDataAsset;
|
PickupTemplate = enemyDataAsset->PickupDataAsset;
|
||||||
OnDamagedSound = enemyDataAsset->OnDamagedSoundBase;
|
OnDamagedSound = enemyDataAsset->OnDamagedSoundBase;
|
||||||
OnDeathSound = enemyDataAsset->OnDeathSoundBase;
|
OnDeathSound = enemyDataAsset->OnDeathSoundBase;
|
||||||
|
OnDamagedNiagaraSystem = enemyDataAsset->OnDamagedNiagaraSystem;
|
||||||
|
OnDeathNiagaraSystem = enemyDataAsset->OnDeathNiagaraSystem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +112,8 @@ void AEnemyCharacter::ResetData_Implementation()
|
|||||||
PickupTemplate = nullptr;
|
PickupTemplate = nullptr;
|
||||||
OnDamagedSound = nullptr;
|
OnDamagedSound = nullptr;
|
||||||
OnDeathSound = nullptr;
|
OnDeathSound = nullptr;
|
||||||
|
OnDamagedNiagaraSystem = nullptr;
|
||||||
|
OnDeathNiagaraSystem = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
float AEnemyCharacter::GetCapsuleRadius_Implementation()
|
float AEnemyCharacter::GetCapsuleRadius_Implementation()
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#include "Engine/DataAsset.h"
|
#include "Engine/DataAsset.h"
|
||||||
#include "EnemyDataAsset.generated.h"
|
#include "EnemyDataAsset.generated.h"
|
||||||
|
|
||||||
class UPaperFlipbook;
|
|
||||||
class UBehaviorTree;
|
class UBehaviorTree;
|
||||||
|
class UNiagaraSystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -33,4 +33,10 @@ public:
|
|||||||
|
|
||||||
UPROPERTY(EditDefaultsOnly, Meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditDefaultsOnly, Meta = (AllowPrivateAccess = "true"))
|
||||||
TObjectPtr<USoundBase> OnDeathSoundBase = nullptr;
|
TObjectPtr<USoundBase> OnDeathSoundBase = nullptr;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, Meta = (AllowPrivateAccess = "true"))
|
||||||
|
UNiagaraSystem* OnDamagedNiagaraSystem;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, Meta = (AllowPrivateAccess = "true"))
|
||||||
|
UNiagaraSystem* OnDeathNiagaraSystem;
|
||||||
};
|
};
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "GameFramework/Character.h"
|
#include "GameFramework/Character.h"
|
||||||
#include "VampireCharacter.generated.h"
|
#include "VampireCharacter.generated.h"
|
||||||
|
|
||||||
|
class UNiagaraSystem;
|
||||||
class AWeapon;
|
class AWeapon;
|
||||||
class UWeaponInventoryComponent;
|
class UWeaponInventoryComponent;
|
||||||
class UInputAction;
|
class UInputAction;
|
||||||
@ -43,6 +44,12 @@ protected:
|
|||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
USoundBase* OnDeathSound;
|
USoundBase* OnDeathSound;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
|
UNiagaraSystem* OnDamagedNiagaraSystem;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
|
UNiagaraSystem* OnDeathNiagaraSystem;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Sets default values for this character's properties
|
// Sets default values for this character's properties
|
||||||
AVampireCharacter();
|
AVampireCharacter();
|
||||||
|
@ -8,7 +8,7 @@ public class vampires : ModuleRules
|
|||||||
{
|
{
|
||||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput", "Paper2D" });
|
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput", "Paper2D", "Niagara" });
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user