Added NiagaraSystem for Gun Particle Effect

This commit is contained in:
Philip W 2022-11-29 01:54:45 +00:00
parent be0766cf0c
commit 07e7f8c70f
7 changed files with 26 additions and 5 deletions

BIN
Content/Blueprints/Combat_UI/BP_TurnBaseCombatV2.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
Content/Blueprints/Combat_UI/NS_GunEffect.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

View File

@ -126,6 +126,14 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
return;
}
if (GunEffect)
{
//Get Static Mesh Location on the player actor
const UStaticMeshComponent* GunComponent = Cast<UStaticMeshComponent>(PlayerActor->GetComponentsByTag(UPrimitiveComponent::StaticClass(), FName("Gun"))[0]);
const FVector GunLocationOffset = GunComponent->GetSocketTransform("Muzzle").TransformPosition(FVector(-100, 0, 0));
UNiagaraFunctionLibrary::SpawnSystemAtLocation(GetWorld(), GunEffect, GunLocationOffset, PlayerActor->GetActorRotation());
}
CurrentComboString = "";
UpdateComboString(CurrentComboString);
RevertActionPoints();

View File

@ -6,9 +6,13 @@
#include "Components/Button.h"
#include "Components/ProgressBar.h"
#include "Components/TextBlock.h"
#include "NiagaraComponent.h"
#include "NiagaraFunctionLibrary.h"
#include "GameFramework/GameStateBase.h"
#include "TurnBaseCombatV2.generated.h"
class UNiagaraSystem;
UCLASS()
class THE_TWILIGHT_ABYSS_API ATurnBaseCombatV2 : public AGameStateBase
{
@ -30,6 +34,9 @@ public:
UPROPERTY(EditDefaultsOnly)
int SulfurResource = 10; // W
UPROPERTY(EditDefaultsOnly)
UNiagaraSystem* GunEffect;
UPROPERTY(VisibleAnywhere)
AActor* PlayerActor;
UPROPERTY(VisibleAnywhere)

View File

@ -8,7 +8,7 @@ public class the_twilight_abyss : ModuleRules
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG" });
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Niagara" });
PrivateDependencyModuleNames.AddRange(new string[] { });