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